Skip to content

Building your Kitura application on XCode

Daniel Firsht edited this page Jun 22, 2016 · 24 revisions

Setting up an XCode project for your Kitura application

Currently, you can build Kitura-based applications in XCode. This gives you features such as debugging, autocompletion, and syntax checking. The Swift package manager has the ability to generate XCode projects by reading your Package.swift file. It will automatically set up several targets that will be built using XCode- note that when XCode builds the project it is not using swift build rather using its normal build process.

  1. Install the supported snapshot of the Swift toolchain
  2. Go to your project directory where you have your Package.swift file
  3. Run swift package generate-xcodeproj
  4. Open the generated project in XCode. Its name matches the name in the Package.swift file.
  5. Change the build scheme to your runnable executable (mine is TodoList). By default it is the module of the same name which won't run.
  6. Run :)

Troubleshooting

Seeing error ld: library not found for -lCHttpParser for architecture x86_64 on build:

To solve this, go to your build settings and add $SRCROOT/.build/debug to the Library Search Paths for the KituraNet and Kitura targets.

Develop iOS application and Kitura on the same workspace

  1. Follow the above instructions for creating an XCode project for your Kitura-based backend application. ./TodoList-server.xcodeproj
  2. Create a new iOS project and sources in a new subdirectory ex. client/TodoList-ios.xcodeproj
  3. Create a new Xcode workspace in the root of your directory ./TodoList.xcworkspace
  4. Open up finder and drag and drop your TodoList-server.xcodeproj and TodoList-ios.xcodeproj to your workspace.
  5. Be sure to choose to create new references to these projects and sources, but do not actually copy the files in the filesystem.
  6. Select the scheme you wish to build the server and the client respectively.
Clone this wiki locally