When I was a newbie to swift, I spent a lot of hours getting this working.
Setup: Xcode 6+, Parse SDK 1.6.2+, iOS 8+
Setting up Parse SDK in Xcode
- Create a new account at Parse.com
- Create a new Application
- Once your app is set up, Parse will provide you your keys. Note these keys and keep them safe
- From the Downloads section of Parse.com, download the SDK
Set up your Xcode project
- Create a new Xcode project and remember to select the Language as Swift
- Once the Application is created, click on your Project and go to “Build Phrases”.
In the List “Link Binary With Libraries” you will have to add these Frameworks to use Parse.AudioToolbox.framework
CFNetwork.framework
CoreGraphics.framework
CoreLocation.framework
libz.dylib
MobileCoreServices.framework
QuartzCore.framework
Security.framework
StoreKit.framework
SystemConfiguration.framework
libsqlite3.dylib - Now drag the Parse.framework you downloaded before into your Xcode Project. Remember to check “Copy Items if needed” when you bring in the framework file
Make Parse SDK useable in Swift
Parse SDK is written in Objective-C. In order to use Objective C code in a swift project, you need to link the Objective-C header files using a special Bridging file. You can make Xcode do the work of setting up an empty bridging file.
- Create a new File (File -> New -> File) of type Objective-C File.
- You can use any name for this file. I am going to call it Dummy.m. We are not going to use this file. However, this will make Xcode ask you to create the bridging file
- Select yes. Xcode will add 2 files to your project – Dummy.m and the Bridging file. Lets call it BridgingHeader.h
- Add the following to your BridgingHeader.h
#import <Parse/Parse.h>