Slide 1

Slide 1 text

Using CocoaPods for Objective-C Library Management Richard Lee Polydice, Inc.

Slide 2

Slide 2 text

iOS Dev Since 2010 Richard Lee @dlackty everywhere

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Who know this?

Slide 5

Slide 5 text

Three20 •UI collections & utilities for iOS •Derived from old Facebook for iPhone •#1 starred Objective-C project on GitHub •Where I started my journey to OSS •Abandoned project for around a year though •Also, Three20 is notorious for...

Slide 6

Slide 6 text

It is so hard to add Three20 to my project .

Slide 7

Slide 7 text

Cocoa library installation Install Cocoa library is hard because •Library / framework dependencies •Automatic reference counting v.s. non-ARC •Header files import dependencies •Compiler choices (gcc / gcc-llvm / clang) •Xcode / iOS version differences

Slide 8

Slide 8 text

UIViewController NSArray TTNavigator FBGraphObject PSTCollectionView AFNetworkOperationQueue Even worse, there is no namespace in Objective-C

Slide 9

Slide 9 text

CocoaPods

Slide 10

Slide 10 text

CocoaPods’s goals •Make working with dependencies simple •Improve library discoverability and engagement

Slide 11

Slide 11 text

Podfile lists the dependencies of your app How CocoaPods works? Podfile.lock locks the versions of pods Podspec contains specs of pods Pod represents a Cocoa library

Slide 12

Slide 12 text

Start using CocoaPods today! Create your Podfile Install dependencies Install CocoaPods Then you’re ready to go!

Slide 13

Slide 13 text

Install CocoaPods: $ [sudo] gem install cocoapods $ pod setup

Slide 14

Slide 14 text

Sample Podfile platform :ios, :deployment_target => '5.0' pod 'Nimbus/Core' pod 'Nimbus/NetworkControllers' pod 'Nimbus/WebController' pod 'AFNetworking' pod 'BlocksKit', '=1.5.2' pod 'SSPullToRefresh', '>=1.0.0' pod 'SDURLCache' pod 'Facebook-iOS-SDK' pod 'iCookSDK', :git => "git@..."

Slide 15

Slide 15 text

Install dependencies: $ pod install

Slide 16

Slide 16 text

Open app.xcworkspace and everything is done!

Slide 17

Slide 17 text

Nice! But...what if, there’re no Podfile available for my desired library?

Slide 18

Slide 18 text

Create Podspec Podspec describes library’s •Basic infos (Name / Description / Version) •Where to download? (Mostly Git) •Copyright info (Author and license) •Source files / Header files / Resource files •Compile settings •Library dependencies

Slide 19

Slide 19 text

Create Podspec: $ pod spec create OSDCView Lint Podspec: $ pod spec lint OSDCView

Slide 20

Slide 20 text

CocoaPods’s goals •Make working with dependencies simple •Improve library discoverability and engagement

Slide 21

Slide 21 text

Find Pods from CocoaPods.org

Slide 22

Slide 22 text

Find Docs from CocoaDocs.org

Slide 23

Slide 23 text

Find UIs from CocoaControls.com

Slide 24

Slide 24 text

You can be part of us! The app universe need your help! •Release open source libraries •Write Podspec for others •Maintain current Podspecs Just send pull requests to CocoaPods repos!

Slide 25

Slide 25 text

Thank you for listening!

Slide 26

Slide 26 text

Q&A?