How to integrate the iOS SDK into a Swift Xcode application

How to integrate the iOS SDK into a Swift Xcode application

Prior to the steps in this article, make sure you follow the iOS SDK implementation walkthrough up until the Configure the Server connections section. In this tutorial, you will continue from the Configure the Server connections section.

The example in this article is using iOS AirWatch SDK version 5.4.1 and Xcode 7.1.

Initializing the SDK

In order to use Objective-C code in your Swift application, Xcode makes use of bridging headers.

  • Add a new header file to your Xcode project and include the two lines shown below in this header file. The header file can be named anything, for example AWHeaders.h


  • Head to your applications Build Settings > Swift Compiler – Code Generation. Double click on the field to the right of the Objective-C Bridging Header so that a text field box appears. See the figure below.


  • Drag the header file you created into the textfield so that the full, absolute path of the Header file appears.


You will now need to implement all the required methods from the AWSDKDelegate class inside of your AppDelegate.swift.

  • Conform to the AWSDKDelegate protocol:


  • Add in the rest of the required methods:

Set your callback scheme and the delegate:


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {


        AWController.clientInstance().delegate = self;

        return true



Start the AWController:


func applicationDidBecomeActive(application: UIApplication) {




Implement the remaining delegate methods:


func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {

      return AWController.clientInstance().handleOpenURL(url, fromApplication: sourceApplication);



func initialCheckDoneWithError(error: NSError!){



func receivedProfiles(profiles: [AnyObject]!){



func unlock() {



func lock() {



func wipe() {



func stopNetworkActivity(networkActivityStatus: AWNetworkActivityStatus) {


func resumeNetworkActivity() {




Finishing Up

The basic SDK functionality has been added to the project. Currently, the SDK is only being initialized and additional source code will need to be added to implement the desired use of the SDK. To recap, in order to use the SDK, the application must be pushed as a managed app from the AirWatch console.

Have more questions? Submit a request


Article is closed for comments.