Over a million developers have joined DZone.

Generate Xcode Project via Swift Package Manager

Find out how to generate an Xcode project using the Swift Package Manager in this article.

As part of my journey with Swift, I was watching this WWDC 2016 video – “Going Server-side with Swift Open Source” and may be at 31:36 of the video my colleague Pat mentioned, ” I went through and created a Xcode project”. The Xcode project was created for debugging the server-side code under Bluepic-Server folder of Bluepic, a sample photo sharing application for iOS. As a Swift newbie, I was wondering how did he do that? I started exploring various options like CMake, QT etc. and was not getting what I wanted.

While trying KituraA web framework and HTTP server for Swift on Linux(Ubuntu), I was reading through the documentation of Package manager  and came across this instruction

Using a Swift snapshot, it is possible to use the package manager’s support for generating an Xcode project.

If you already have Xcode 7.3.1 or above installed on your Mac,follow the Swift snapshot installation steps and the end result should look like this:

Swift Snapshot - Xcode

On a Terminal, Run the below command (if you haven’t done yet)

export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

Navigate to BluePic-Server folder on Terminal and run the below command to generate .XcodeProj,

swift packagegenerate-xcodeproj

If everything goes as expected, You should see Bluepic-Server.xcodeproj file in the folder:

Generated .xcodeproj file

http://vidyasagarmsc.com/2016/07/generating-xcode-project-using-swift-package-manager/


Vidyasagars-MacBook-Pro:Bluepic-Server VMac$ swift package generate-xcodeproj
Cloning https://github.com/IBM-Swift/Kitura.git
HEAD is now at d643c31 IBM-Swift/Kitura#513 Changed BluePic link
Resolved version: 0.15.7
Cloning https://github.com/IBM-Swift/Kitura-net.git
HEAD is now at 6193ca8 Avoid bottleneck on lock in __CFGetConverter by performing fewer, longer character conversion operations (#32)
Resolved version: 0.15.6
Cloning https://github.com/IBM-Swift/Kitura-sys.git
HEAD is now at 3ef9ec7 IBM-Swift/Kitura#466 Updated to latest LoggerAPI
Resolved version: 0.13.2
Cloning https://github.com/IBM-Swift/LoggerAPI.git
HEAD is now at 9b30704 Merge pull request #8 from tkhuran/develop
Resolved version: 0.7.1
Cloning https://github.com/IBM-Swift/BlueSocket.git
HEAD is now at 6e8915c Added blurb about BlueSSLService add-on.
Resolved version: 0.5.20
Cloning https://github.com/IBM-Swift/CCurl.git
HEAD is now at aa7833f Update Package.swift
Resolved version: 0.1.1
Cloning https://github.com/IBM-Swift/CHttpParser.git
HEAD is now at 41daabb IBM-Swift/Kitura#365 Removed references to code installed externally and the pkgConfig file that is no longer needed.
Resolved version: 0.1.1
Cloning https://github.com/IBM-Swift/SwiftyJSON.git
HEAD is now at a1e6611 Added UInt support for Linux
Resolved version: 7.0.4
Cloning https://github.com/IBM-Swift/Kitura-TemplateEngine.git
HEAD is now at 38e7cdb IBM-Swift/Kitura#459 Explicitly indicate that there are no dependencies
Resolved version: 0.13.0
Cloning https://github.com/IBM-Swift/Kitura-CouchDB.git
HEAD is now at d63d287 Updated version of Kitura-net
Resolved version: 0.15.0
Cloning https://github.com/IBM-Swift/HeliumLogger.git
HEAD is now at c43bfd1 IBM-Swift/Kitura#479 added static function use()
Resolved version: 0.7.4
Cloning https://github.com/IBM-Swift/Swift-cfenv.git
HEAD is now at f82bd3f Renaming module.
Resolved version: 1.1.0
Cloning https://github.com/ibm-bluemix-mobile-services/bluemix-objectstorage-swift-sdk.git
HEAD is now at 7bf6373 updated for Kitura-Net 0.13.7
Resolved version: 0.3.2
Cloning https://github.com/ibm-bluemix-mobile-services/bluemix-simple-http-client-swift.git
HEAD is now at b92f0c7 Updated to use  Kitura-net 0.15.x
Resolved version: 0.2.5
Cloning https://github.com/ibm-bluemix-mobile-services/bluemix-simple-logger-swift.git
HEAD is now at 0fdd30d updated readme
Resolved version: 0.2.0
Cloning https://github.com/ibm-bluemix-mobile-services/bms-mca-kitura-credentials-plugin.git
HEAD is now at 473564e updated to support no idToken scenario
Resolved version: 0.1.6
Cloning https://github.com/IBM-Swift/Kitura-Credentials.git
HEAD is now at 99f99c8 IBM-Swift/Kitura#496 Fixed setting of headers from passed plugins
Resolved version: 0.15.3
Cloning https://github.com/IBM-Swift/Kitura-Session.git
HEAD is now at ab8440f Update Kitura version
Resolved version: 0.7.1
Cloning https://github.com/IBM-Swift/BlueCryptor.git
HEAD is now at 9d020ee Update for latest toolchain.
Resolved version: 0.2.5
Cloning https://github.com/IBM-Swift/CommonCrypto.git
HEAD is now at 02a5c05 Merge pull request #4 from Bouke/master
Resolved version: 0.1.4
Cloning https://github.com/ibm-bluemix-mobile-services/bms-mca-serversdk-swift.git
HEAD is now at 4aa6b9f Updated to support no idToken available scenario
Resolved version: 0.2.2
Cloning https://github.com/ibm-bluemix-mobile-services/bms-pushnotifications-serversdk-swift.git
HEAD is now at ae5402e Added public initializers to Notification struct
Resolved version: 0.1.2
note: you may be able to install libcurl using your system-packager:

    brew install curl
generated: ./BluePic-Server.xcodeproj


Related Refcard:

Topics:
swift ,mobile ,xcode ,ios ,code

Published at DZone with permission of Vidyasagar Machupalli, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}