This file will help you to init project with Xcode and Objective C with pagage manager Cocoapods. The head first are make sure that we have installed Cocoapods on our system.
IMPORTANT: Make sure you have ruby cli installed on your system.
sudo gem install cocoapods
After have installed cocoapods, you have to export the environment vars for your system can to recognize cocoapods cli.
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
-
Now you need create a new Xcode Project with ObjC, choose the location of your project and make sure mark the Git initialization option is selected.
-
Close Xcode.
-
Open your favorite terminal (My Favorite terminal is iTerm with "oh my zsh" plugin).
-
Go to the folder project from your terminal with command "cd your/folder/proect/directory".
-
Now you have to create the famously "Podfile":
touch Podfile
-
After that command, if you list the content directory you'll can see file with name Podfile. Now it's time to run the next command.
pod install
Output
CocoaPods 1.0.0.beta.2 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `NameProject.xcworkspace` for this project from now on.
Sending stats
Sending stats
Sending stats
Pod installation complete! There are 0 dependencies from the Podfile and 0 total
pods installed.
[!] [!] The Podfile does not contain any dependencies.
7.- The last command is in charge of create project the dependencies and new Workspace to work on Xcode.
`NameProject.xcworkspace`
-
Now you can open the new Workspace from the terminal with the next command, or open the from Finder app.
open NameProject.xcworkspace
Now, you can add dependency libs to project. You need add some lines to Podfile like the next sample:
platform :ios, '9.0'
inhibit_all_warnings!
target "NameProject" do
pod 'ObjectiveSugar', '~> 0.5'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
puts "#{target.name}"
end
end
Now you can run for download and install dependencies
pod install
Enjoy it!!!
@galileoguzman