Challenge 18: CocoaPods
I’m still sick and couldn’t manage to do anything yesterday. But now I had some time over and tried to install CocoaPods.
What is CocoaPods?
CocoaPods is a library of pre-made functions so you don’t have to write everything from scratch. Using CocoaPods also means it’s under maintenance and you don’t have to download and manually reinstall every Pod. You just enter in your terminal Pod Install. Also if you have used Composer, NPM, Gems or Bower, you’ll understand CocoaPods.
You know how to navigate with the terminal and you have xcode installed.
How to do it
- Open xcode and create a project. Close Xcode when you are done.
- Use the terminal and navigate to the folder of the project you just created.
- In the terminal write touch Podfile, this will create the Podfile.
- Then write open Podfile, this will open the file so you can edit it.
- In the text field, you write the code. For example I used SwiftyJson and here’s how my Podfile looks like.
platform :ios, '8.0'
target 'Challenge 18' do
pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
Then in your terminal, you write Pod install. This can take a while.
When it’s all done, go to your folder and open the new workspace. Mine is called Challenge 18.xcworkspace. Then you can start to edit.
Swift-challenges - My personal challenge of learning xcode and swiftgithub.com
The person in the video creates in object-c, it doesn’t matter.