Pro Yearly is on sale from $80 to $50! »

Using CocoaPods for Objective-C Library Management

Using CocoaPods for Objective-C Library Management

Presented at OSDC.tw 2013

Aa0358f6740f1bf02911e5300e08e800?s=128

Richard Lee

April 20, 2013
Tweet

Transcript

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

  2. iOS Dev Since 2010 Richard Lee @dlackty everywhere

  3. None
  4. Who know this?

  5. 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...
  6. It is so hard to add Three20 to my project

    .
  7. 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
  8. UIViewController NSArray TTNavigator FBGraphObject PSTCollectionView AFNetworkOperationQueue Even worse, there is

    no namespace in Objective-C
  9. CocoaPods

  10. CocoaPods’s goals •Make working with dependencies simple •Improve library discoverability

    and engagement
  11. 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
  12. Start using CocoaPods today! Create your Podfile Install dependencies Install

    CocoaPods Then you’re ready to go!
  13. Install CocoaPods: $ [sudo] gem install cocoapods $ pod setup

  14. 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@..."
  15. Install dependencies: $ pod install

  16. Open app.xcworkspace and everything is done!

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

    library?
  18. 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
  19. Create Podspec: $ pod spec create OSDCView Lint Podspec: $

    pod spec lint OSDCView
  20. CocoaPods’s goals •Make working with dependencies simple •Improve library discoverability

    and engagement
  21. Find Pods from CocoaPods.org

  22. Find Docs from CocoaDocs.org

  23. Find UIs from CocoaControls.com

  24. 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!
  25. Thank you for listening!

  26. Q&A?