Using Cocoapods for the XCode Projects
Using Cocoapods for the XCode Projects
We covered installing the cocoapods on the system in the previous section of the guide. In this tutorial portion, we’ll install the Firebase framework in the app using Cocoapods.
First, let’s make a new project in XCode called TestPodProject specifically for this reason. We are saving this project to Desktop at this point.
Now that the project has been established, we dismiss it, launch the terminal, and use the following command to navigate to the project directory.
$ cd /Desktop/TestCocoapods
In order to initialize a Podfile in the project, execute the following command.
$ pod init
The following content can be found if we check into Podfile’s content right now.
This means that in order to install Firebase in our project, we must include it in the Podfile as pod ‘Firebase’ in the do-end block, as seen below.
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'TestCocoapods' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for TestCocoapods
pod 'Firebase'
end
We now need to type the following command into the terminal in order to install the pod.
$ pod install
The following output will be displayed on the terminal by it.
The original XCode project, Firebase library, and dependencies will now be bundled into a new project xcworkspace file that is generated. We will no longer be using the xcodeproj file and will instead be using the xcworkspace file.
The TestCocoapods project and the pod project, which includes the Firebase library, are located when we open the TestCocoapods.xcworkspace file.