Swift BridgingHeader file – iOS 10 Minute Quick Hack

by Applied Informatics

When writing Swift you will eventually run into the situation where you need to include Obj-C based code libraries, lucky for us, Apple has made it super easy by using what is called a “Bridging Header” file.

Here is how you create it,

  1. Create a new “Header File” file. In XCode this is done by going to “File > New > New File > iOS > Header File”
  2. Add the module you need to import, for example to import CommonCrypto library you would add “#import <CommonCrypto/CommonDigest.h>”
  3. Add the file to your Build Settings under the “Swift Compiler – Code Generation” section using the name “Objective-C Bridging Header” and point it to the file created in step 1.

Your file should look something like this.

// BurningMan-Bridging-Header.h
// BurningMan
// Created by Nickolas Whiting on 11/9/15.
// Copyright © 2015 Applied Informatics. All rights reserved.

#import <CommonCrypto/CommonDigest.h>
#import <Google/Analytics.h>

And your build settings should include something like this,

Screen Shot 2016-01-19 at 7.54.54 PM


Thats it, you are done!

This is part of our iOS 10 Minute Quick Hack series. Stay tuned for more!

One thought on “Swift BridgingHeader file – iOS 10 Minute Quick Hack”

  1. Very interested in America Walks. I am the National Race Walk Development Coordinator as well as one of the 11 members of the IAAF ( International Association of Athletics Federations) That will be having a meeting on May 9 to discuss how we can both generate more interest in the Olympic Track and Field event of Race Walking and be socially responsible and get average citizens to walk more for their health. Wondering if any collaboration may be of benefit?

Leave a Reply

Your email address will not be published. Required fields are marked *

Mobile Research Apps

We have deep expertise in design and development of mobile research apps that work on both iOS and Android securely.

Contact us now

Popular Posts