Writing a Swift App With Firebase

Swift is the latest and greatest from Apple for writing iOS and OSX applications. With any luck it will eventually replace Objective-C as the goto language. One doesn’t need to wait though, as one of the banner features of Swift is the ability to include Objective-C code right into your Swift projects. As it turns out it is quite easy to use frameworks that were originally written specifically for ObjC based apps.

Here I’ll walk you through, step-by-step, on how to use a Firebase backend with your app.

Step 1 #

Open Xcode 6-beta and start a new project. Select Swift as your language of choice.

Step 2 #

Create a new Objective-C file in your project. When prompted if you would like to include a bridging header, say “yes”. Then, delete the .m file that you created keeping only the bridging-header.h file that was created for you. Add the following line to that file:

#import <Firebase/Firebase.h>

Step 3 #

Download the Firebase SDK from https://www.firebase.com/docs/ios-quickstart.html

Also add the following dependencies to your project:

Step 4 #

Finally, go to your build path and find the option called Other Linker Flags and add the flag:

-ObjC

That’s it! Now you have full access to the Firebase SDK within your Swift project!

 
198
Kudos
 
198
Kudos

Now read this

Don’t leave anything out.

There are nearly endless ways to find information about anything online. As a matter of fact, I am contributing to this mass of knowledge right now. The sheer magnitude of information on every subject can seem to be both a blessing and a... Continue →