Using Cocoapods for the XCode Projects

In the previous section of the tutorial, we discussed how to install the cocoapods on the system. In this section of the tutorial, we will use the cocoapods to install the firebase framework in the project.

For this purpose, first, let's create a new project in XCode and name it as TestPodProject. Here, we are saving this project to Desktop.

Using Cocoapods for the XCode Projects

Now, as we have created the project, we close the project and open the terminal and move to the project directory by typing the following command.

Now, run the following command to initialize a Podfile in the project.


Using Cocoapods for the XCode Projects

Now, if we look at the content of Podfile, we will find the following content.

Using Cocoapods for the XCode Projects

Now, if we want to install the firebase in our project, we need to mention it in the Podfile as pod 'Firebase' in the do - end block as given below.

Now, to install the pod, we need to run the following command in the terminal.

It will generate the following output on the terminal.

Using Cocoapods for the XCode Projects

Now, it will generate a new project xcworkspace file that bundles the original XCode project, Firebase library, and dependencies. From now onwards, we will be going to use the xcworkspace file instead of the xcodeproj file.

If we open the TestCocoapods.xcworkspace file, we will find the TestCocoapods project along with the pod project, which contains the Firebase library.

Using Cocoapods for the XCode Projects




Latest Courses