SCADE

Develop Swift server applications on Docker

This requires SCADE version 0.9.9.x or higher and Docker for Mac

Introduction

Swift is our #1 language for mobile client side development on Android and iOS. However, a growing number of developers are using Swift on the server as well. To support this, we added Docker support to our IDE. Now you can easily code server applications and run them on Docker.

Prerequisites

We currently support the following setup

  • Apple Mac OSX
  • XCode 10
  • Docker for Mac (latest version)
  • Swift 4.1 (Swift 4.2 few weeks away)

Installation

  • Just make sure Docker for Mac is installed and running

Running your Hello World server app

Here the steps to creating your first Hello World REST service

Start SCADE IDE

Create a new Swift Server project

a. Select File|New and choose Kitura Project

b. Specify the name of the server project and choose Basic type. Then press Finish.

c. The server project is created. Open the main file and you see a basic HTTP route implementation

import statement

As you can see, the import statement is marked as having an error. This message will disappear after compiling the project

Compile project

a. Select the project
Pick a project to compile. Use the project picker and select your project with Mac Docker as the target.

b. Select Docker on Mac

c. Press the compile button

When pressing the compile button, we download all docker images, sources and compile the project. Depending on your internet connection speed, this takes a while (2 - 10 minutes). However, this is only for the initial startup, after that, compilation and running the server app is immediate

d. After downloading and compiling, you see the final compilation output on the screen

First time, creating the project takes time

When you compile your server project for the first time, this will take some time (3-5 minutes), because a lot happens under the cover:

  • The Swift docker file is downloaded
  • The Server Framework is downloaded
  • The project is compiled

Run your server app

a. Press the run button

b. You see the docker command for running your server!

c. Open your first server app on http://localhost:8080

Congratulation. Your first Swift server app is running on Docker

Develop Swift server applications on Docker


This requires SCADE version 0.9.9.x or higher and Docker for Mac

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.