How We Created the Swift-Compatible SDK You Need to Integrate

A few months ago, Apple announced Swift: a brand new programming language that sent ripples throughout the dev community. Many were excited with what Apple had created – us iOS devs were finally getting proper closures, tuples, multiple returned types, and much more.

What does this mean for Kiip? How would we ensure devs could use Swift and still tap into the power of Kiip? We started by leveraging Swift’s ability to mix and match Objective-C code – what the Kiip SDK is written in – while maintaining a 100% Swift environment. It started with adding our framework to our Swift project.

Since we expose our SDK calls via .h files, we needed a bridging header. A bridging header allows us to “bridge” public objective-c API calls into Swift. While a bit odd at first, it works nicely because you can organize all the .h files you need into your Swift environment. If you need an entire framework, it’s as simple as the following:

* code block *
inside project-bridging-header.h
#import <UIKit/UIKit/h>
#import <KiipSDK/KiipSDK.h>
* code block *

Go to your AppDelegate and stare at this document, because you won’t need to add an ‘import KiipSDK’ line! The marvel of Swift is that all public classes declared in the bridging-header are already exposed and don’t need to be imported inside the same project space. Woohoo!

Now, hit command+shift+r. Did that build correctly? Great! Objective-C and Swift are co-existing. Simple, right? And like that, you can bring just about any Objective-c code you’ve written into Swift. Next, navigate to the following method:

` func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { } `

You’ll create a var of type Kiip. You’ll also use our init function mapped to Swift:

` var kiip: Kiip = Kiip(appKey: KP_APP_KEY, andSecret:KP_APP_SECRET) `

Where the ALL-CAPS values are constants defined by `let` statements. Remember, in Objective-C, this would look like:

` Kiip *kiip = [[Kiip alloc] initWithAppKey:@”app_key” andSecret:@”app_secret”];`

If you notice, Kiip’s header file in Objective-C has two named parameters: appKey and appSecret. That’s what we are using to call the same function – named parameters. And like that, we’ve brought in one of our API calls into our Swift app.

There you have it! By following the principles of Swift mix and match, we are able to use any Objective-C inside a Swift environment. While we could spend more time covering all of Kiip inside Swift in this blog post, we spared you the pain and created a couple of Swift examples for your viewing. Check ‘em out here.

If you’re building a Swift app, download Kiip’s SDK today for immediate integration. Just visit

If you have any questions, you can get at me on Twitter @SahilRoyVerma.

Rewards lead to higher engagement among users and better monetization for developers. 84 percent of mobile users say they prefer mobile rewards vs. ads, and over 3,000 games and apps already use Kiip to monetize. Learn more about Kiip at


More from Kiip

  • Introducing Our Swift-Compatible SDKIntroducing Our Swift-Compatible SDK Hey, developers! Meet our Swift-compatible SDK. It’s an SDK for Apple’s new programming language, with little to no effort required on your part. What it means: If you already have the […]
  • How SDKs Affect App Ratings in the App StoreHow SDKs Affect App Ratings in the App Store MixRank is a mobile intelligence company that monitors in-app technologies and advertising campaigns to identify industry trends. Using MixRank, we examined data from over 242 million […]
  • Why You Should Make Your Apps Resizable Right NowWhy You Should Make Your Apps Resizable Right Now There are rumors that Apple will release larger iPhones this Fall. Fueling these rumors are early iPhone renders and cases built from iPhone 6 specs that were supposedly sent to […]