Install Skillz for Swift

Swift is a newer alternative to Objective-C for creating iOS apps. Fortunately, it is extremely easy to make our Objective-C SDK work nicely with Swift with just one extra file.

 

Step 1: Bring the Skillz bridging header into your project

Open up the SDK and navigate to the Swift folder. Drag the header file inside that folder into your Swift project, in XCode’s Project Navigator pane. Make sure that the “Copy items if needed” checkbox is checked so that the file is copied into the project root.

If you already have a bridging header, just copy the code from our header into yours. You may want to delete any duplicate import statements.

Step 2: Set the project to use the bridging header

Now that the header is in our project, we have to tell XCode to use it as a bridging header.

Go to the bottom of the project’s build settings. Under Swift Compiler - Code Generation is the Objective-C Bridging Headersetting. Set this to point to the location of the header relative to the project root.

After completing these steps, the SKillz SDK should be properly included in your Swift project and you should be able to use it without errors.

Now, perform the Skillz integration just like any Objective-C project, but with Swift syntax. If you are unsure how certainSkillzDelegate callbacks transfer to Swift syntax, take advantage of XCode’s autocomplete.