Here are my notes on getting a Kitura application running from Xcode locally on my mac.
Create the project
1. Sign up for a Bluemix account. It’s free to start, and there is a free tier to continue using the service.
2. Install the IBM Cloud Tools for Swift GUI App, and sign in with the account you just created.
3. Create a Kitura project using the IBM Cloud Tools for Swift app. It’s a pretty intuitive process but you can find it spelled out here.
4. The Kitura project creation process will create a number of files in a directory on your local machine (which you would have picked during the previous step). Navigate to this directory (there should be a file
Package.swift in there) using the terminal.
Add the proper toolchain
5. Find the appropriate toolchain version. The readme file in the Kitura project should specify which toolchain to use. At the time of this writing
DEVELOPMENT-SNAPSHOT-2016-05-03-a was specified.
6. Download the toolchain specified from above from the swift.org snapshot repository. You can identify the proper toolchain by matching the date in the filename of the specified snapshot from step 5.
7. Install the toolchain by double clicking on it. From the terminal, temporarily add it to your path like so:
8. Create the Xcode project. From the terminal run
swift build -X
9. From the terminal run
make which will create and populate a
.build folder. You’ll need this later (in step 11) when you link to two of the libraries from Xcode that
make builds and places in that folder.
10. Open the project in Xcode. From the menu bar select Xcode->Toolchains->(the toolchain you installed earlier). Xcode will restart.
$SRCROOT/.build/debug to the
Library Search Paths for the
12. Select the executable build scheme and run it. The Xcode console will specify the url and port the server is accessible at. Paste this into a browser to poke it.
13. Toss in a breakpoint and start stepping through code.
You’re now debugging a web application written in Swift. Heck yeah!