Open the terminal app (Finder>Applications>Utilities>Terminal) and type the following then hit enter to install.
sudo gem install cocoapods
You may have to type y (then hit enter) during the installation.
Now navigate to your project’s directory using cd. An example of navigating to a project’s directory is mentioned below.
cd Documents/Xcode-8/MyApp //The above is an example. Please type the actual directory of your project.
Intialize the pod using the command below.
Open the podfile in your text editor program. We recommend Sublime Text.
Add the pods that you would like to install. Please visit the Cocoapods website to find pods and their installation code. An example of a podfile is below.
Please note that some services such as Firebase use multiple podfile for each of their services.
# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' target 'MyApp' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'Firebase/Core' pod 'Firebase' pod "TextFieldEffects" pod 'GoogleSignIn', '~> 5.0' pod 'Firebase/Auth' # Pods for MyApp target 'MyAppTests' do inherit! :search_paths # Pods for testing end target 'MyAppUITests' do # Pods for testing end end
Install the pod using the command below.
Quit Xcode and all projects and use MYAPP.xcworkspace from now on rather than MYAPP.xcodeproject. These files can be found from finder where you saved the files.