Friday, 24 March 2017

Using CocoaPods in Your Swift3 and Objective-C Projects


Step 1 - 

Open Terminal

sudo gem install cocoapods


Step 2 -
cd ~/Desktop/CocoapodsTest
 
Step 3 -
 pod init

Step 4 -    CocoaPod then generates the Podfile in project folder like this :
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'CocoapodsTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # Pods for CocoapodsTest
end

 Step 5 - Type the following command to open the file with vim:
vim Podfile
  
 Step 6 -
Suppose you’re going to use Firebase in your Xcode project. To do so, edit the file content like this to configure the Firebase pod.
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'CocoapodsTest' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  # Pods for CocoapodsTest
  pod 'Firebase'
end
  
 Step 7 - That’s it. To exit vim, hit the escape key and then type: 
:wq
  
Step 8 -

pod install



 Step 9 -
  
So from now on, you have to use ProjectName.xcworkspace instead of ProjectName.xcodeproj.
 



 Step 10 -

Now all there’s left to do is use the Firebase pod. Let’s navigate back to Xcode and inside the IDE, go to ViewController.swift. At the top, type:


import Firebase


* And look at that! You are up and running with CocoaPods!

# For more in detail refer link 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home