Wednesday, September 4, 2013

How to use cocospods in managing library dependencies in your iOS project?

In the process of exploring MMDrawerController library, discover cocoapods that are quite useful in managing library dependencies in my iOS project.

In general, CocoaPods is equivalent to MAVEN in J2EE project. Lets walk through all the necessary steps to get the concept on how it works.

Assumption
- Ruby MRI 2.0.0 or 1.8.7 (ships with Mac OS X)

Install CocoaPods
- Open Mac terminal
- Enter "sudo gem install cocoapods" and enter administrator password
- Type in command "pod setup" to install CocoaPods.
- Navigate to the project folder, enter "touch Podfile" command to create Podfile
- Enter command "open -e Podfile" to launch the text editor
- Edit the Podfile file with the configuration as shown below
platform :ios, '5.0' 
pod 'MMDrawerController', '~> 0.4.0'
- Navigate to the project folder that you wish to import the library through cocoa pods.
- Enter "pod install", MMDrawerController will be imported, a project file with ".xcworkspace" extension will be created.
- Open project file with the extension ".xcworkspace", a "Pods" project will be included. All the imported library will be included in the "Pods" project.

No comments: