/Kitura-HelloWorld-iOS

A Hello World example of running Kitura on iOS

Primary LanguageSwiftApache License 2.0Apache-2.0

Kitura Builder for iOS

Kitura/iOS Hello World

Build Status macOS iOS Apache 2 codebeat badge  Slack Status

Simple Hello World Kitura Application (Server Side) embedded in an iOS app (Client Side). The app demonstrates starting and stopping Kitura server, and presents Kitura log on the screen.

Prerequisites

  1. Enable Server-Side Swift with Kitura - see http://www.kitura.io/en/starter/settingup.html
  2. Install Xcode Command Line Tools by running xcode-select --install command in the terminal
  3. Run make Builder/Makefile - it will fetch the Builder submodule (and also the ServerSide submodule)
  4. Create an iOS static library for curl package. Download curl zipped source from https://curl.haxx.se/download/, unzip it and run Builder/Scripts/buildCurlStaticLibrary.sh <path to the unzipped curl source directory>. For example, if you unzip curl in the current directory, in curl-7.43.0 directory, run Builder/Scripts/buildCurlStaticLibrary.sh curl-7.43.0.

We tested working with curl 7.43.0 version.

Build the project in Xcode

  1. Type make openXcode in the terminal, an Xcode instance with a workspace will be opened. The workspace will contain both the client-side and the server-side parts as projects. You should rerun make openXcode any time you change the structure of ServerSide - add a file or add a dependency.
  2. In the opened Xcode workspace, you can edit the code, both the client-side and server-side parts, debug and run the client-side iOS app (ClientSide) with the server side embedded in it.

You will see the URL of your Kitura/iOS server in the start screen of the app. Start the server by flipping the switch "STOPPED" on. Use another device (any OS) on the same Wi-Fi network. Point a browser in the other device to the displayed URL, you should get "Hello World!" message with a timestamp as a response. Alternatively, use the QR code displayed beside the URL of the server.

Publications

See https://developer.ibm.com/swift/2017/03/13/kitura-ios/

Quick Instructions

(macOS Sierra 10.12.4 and Xcode 8.3.2)

  1. Setup (run in a terminal)
xcode-select --install
sudo gem install xcodeproj

git clone https://github.com/IBM-Swift/Kitura-HelloWorld-iOS.git
cd Kitura-HelloWorld-iOS
make Builder/Makefile

curl -O https://curl.haxx.se/download/curl-7.43.0.tar.bz2
bzip2 -d curl-7.43.0.tar.bz2; tar xopf curl-7.43.0.tar; rm -r curl-7.43.0.tar
bash ./Builder/Scripts/buildCurlStaticLibrary.sh curl-7.43.0

For 64Bit (example, iPhone 5s or newer, iPad Air or newer, iPad Mini 2 or newer, iPad Pro or newer)

make openXcode

For 32Bit (example, iPhone 5, 5c, iPad 4)

make openXcode32
  1. Open EndToEnd.xcworkspace
  2. Change scheme to "ClientSide"
  3. Load on iPhone or iPhone simulator
  4. On the running app, turn on the toggle switch above the QR code
  5. On another device, connect to the listed URL

Update - Quick Instructions

  1. git pull to get the latest version of Kitura
  2. Remove the Builder directory
  3. run make openXcode or make openXcode32