The Mobile SDK web doc points users to the Swiftilicio.us tutorial on installing Pods and creating the Objective C bridging header file. The tutorial glosses over a few steps that might not be obvious to new users, as they were not for me, so here is a more detailed tutorial that I hope you fund useful. The screen shots are hard to read in post, so click the expand arrow at the bottom of the image to blow them up.
First, open your Swift project by clicking on the projectName.xcworkspace file.
Next, File -> New -> File IOS Source Header file
Chose Next, then fill in the options show here.
Save As -> Bridging-Header.h
Group, navigate to the project name folder that contains the file ViewController.swift
When you have successfully created the Bridging-Header.h file and it is in the right location, your project folder view will look like this:
Now, click on the top level item with your project name (blue folder beside it) . You will see the build settings page. It will come up with whatever view options you last closed it with, so if you have not opened it before it may look like this. In the search bar upper right, if you type ‘sw’ it will filter as shown. Note that under Swift Compiler there is no option to add an Objective C bridge file.
To the right of the work PROJECT, note the four choices: Basic, All, Combined and Levels. In the startup default settings Basic and Combined will be dark blue. You must click on All and Levels so they are dark blue, and then the Build Settings - Swift Compiler Code Generation options will look like this.
Look at the screen shot below. Note the box with the arrow on top. You open this box by double clicking on the line that is highlighted (Objective-C Bridging Header) directly above where the arrow is. Clic too far away from that arrow and the box will not open up. When the box opens up, it will be empty. Add the line shown below, substituting your path and header file name. YourProjectName/Bridging-Header.h Then hit enter to save it.
Now that line will look like below. If it does not, work at it till it does.
Now you must edit the User Header Search Path and add the path Pods and make it Recursive. To do that, first change the filter in the search bar (upper left) to ‘search’. Then on the line User Header Search Path, where the arrow above the box is, double click to open the box. In the lower left of the box is a plus sign. Click it to add a line that you will fill in. Type the word Pods on the left as shown. Change the right side of the line from non-recursive (default) to recursive.
The last step is to edit the Bridging-Header.h file to include the reference to the SparkCloud.h file. The Objective C header file for the SparkCloud class. Open the file by clicking on it. Add the line #import “SparkCloud.h”
Now, you can open ViewController. swift by clicking on it. In the viewDidLoad() function, open some empty lines after the comment // Do any…, and before the curly brace.
Copy the swift code shown for the .loginWithUser method from this post, about 3/4 of the way down the post
When your ViewController.swift file looks like the one shown below, hit Build, and watch for the Logged in message in the console window. Or, if not logged in, the message “Wrong credentials…”.
Success! Now start adding more snips of the example code and building Apps!