Syed Tariq Syed Tariq - 7 months ago 103
Swift Question

Cannot import Firebase in Swift app

In attempting to learn Firebase, I followed the steps in the IOS Quickstart section of the Firebase website. I use Cocoapods and followed the steps exactly as documented. However, "import Firebase" results in a compiler error. I don't see the Framework any where but I do see the Firebase objective C files.. . By following the manual process of downloading the zip file and adding it to the project I can make it work. However, I would like to understand what I am doing wrong.
Xcode Page

Answer

You shouldn't need to use a Bridging Header.

The Firebase SDK uses Swift module mapping, so you'll have to let CocoaPods know.

Use this podfile:

use_frameworks! # this allows you to use import Firebase
pod 'Firebase', '>= 2.5.0'

Then you should be able to use import Firebase in any Swift file.

Sometimes after opening from CocoaPods install, XCode can get confused. Do a Cmd+K to clean and a Cmd+Shift+R to rebuild. If that still is giving you errors, then restart Xcode and try the clean and build again.