Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started With CocoaPods

Getting Started With CocoaPods

CocoaConf Chicago

Peter Kananen

March 08, 2013
Tweet

More Decks by Peter Kananen

Other Decks in Programming

Transcript

  1. Getting Started with Getting Started with Getting Started with COCOAPODS

    COCOAPODS COCOAPODS Peter Kananen Peter Kananen Peter Kananen @pkananen @pkananen @pkananen
  2. WHY COCOAPODS? WHY COCOAPODS? WHY COCOAPODS? Automate Everything Consistent Workspaces

    Xcode Config FTL Easy Updates Dependency Resolution Easy Experimentation Docs for free!
  3. THE BAD WAY THE BAD WAY THE BAD WAY copying

    source static libraries Case Study: SS Toolkit
  4. BUT I DON'T WANT TO LEARN RUBY! BUT I DON'T

    WANT TO LEARN RUBY! BUT I DON'T WANT TO LEARN RUBY! SURE YOU DO! SURE YOU DO! SURE YOU DO!
  5. BUT I DON'T WANT TO BUT I DON'T WANT TO

    BUT I DON'T WANT TO LEARN LEARN LEARN USE USE USE RUBY! RUBY! RUBY! libraries community cross polination
  6. CONFIGURING YOUR RUBY PROJECT CONFIGURING YOUR RUBY PROJECT CONFIGURING YOUR

    RUBY PROJECT Easiest Easiest Easiest Best Best Best $ [ s u d o ] g e m u p d a t e - - s y s t e m $ [ s u d o ] g e m i n s t a l l c o c o a p o d s $ p o d s e t u p rbenv - Ruby version management bundler - application RubyGem management
  7. 'POD SETUP' 'POD SETUP' 'POD SETUP' What is CocoaPods doing?

    What is CocoaPods doing? What is CocoaPods doing? clones the podspecs master repo into ~/.cocoapods having your own fork makes it easy to contribute allows for local 'pod' operations $ p o d s e a r c h w k t = = > W K T P a r s e r ( 0 . 0 . 1 ) A l i b r a r y f o r p a r s i n g g e o m e t r i e s f r o m W e l l - K n o w n - T e x t ( W K T ) .
  8. ADDING YOUR FIRST POD ADDING YOUR FIRST POD ADDING YOUR

    FIRST POD we get a shiny new .xcworkspacefile! $ c a t P o d f i l e p l a t f o r m : i o s , ' 6 . 0 ' x c o d e p r o j ' P o d D e m o / P o d D e m o . x c o d e p r o j ' p o d ' A F N e t w o r k i n g ' , ' 0 . 9 . 1 ' $ p o d i n s t a l l R e s o l v i n g d e p e n d e n c i e s o f ` . / P o d f i l e ' R e s o l v i n g d e p e n d e n c i e s f o r t a r g e t ` d e f a u l t ' ( i O S 6 . 0 ) D o w n l o a d i n g d e p e n d e n c i e s I n s t a l l i n g A F N e t w o r k i n g ( 0 . 9 . 1 ) G e n e r a t i n g s u p p o r t f i l e s [ ! ] F r o m n o w o n u s e ` P o d D e m o . x c w o r k s p a c e '
  9. MULTIPLE TARGETS MULTIPLE TARGETS MULTIPLE TARGETS p o d '

    A F N e t w o r k i n g ' . . . t a r g e t : s p e c s , e x c l u s i v e : t r u e d o l i n k _ w i t h ' P o d D e m o S p e c s ' p o d ' K i w i ' p o d ' M a g i c a l R e c o r d ' e n d t a r g e t : i n t e g r a t i o n d o l i n k _ w i t h ' P o d D e m o K I F ' p o d ' K I F ' e n d . . .
  10. POD OPTIONS POD OPTIONS POD OPTIONS # C o c

    o a P o d s S p e c s r e p o ( v e r s i o n e d ) p o d ' W K T P a r s e r ' , " > = 0 . 1 . 0 " # a r b i t r a r y l o c a t i o n p o d ' K I F ' , : p o d s p e c = > ' h t t p s : / / g i s t . g i t h u b . c o m / r a w / 4 0 7 3 9 9 4 / 7 3 3 6 a a d e b d d 3 1 9 f 8 8 4 f 1 8 9 7 c 3 9 f d 7 a 3 2 7 8 3 a f 0 e e / K I F . p o d s p e c ' # p r o j e c t d e f i n e d f o r a c o m m i t p o d ' W K T P a r s e r ' , : g i t = > ' h t t p s : / / g i t h u b . c o m / j o e l t u r n b u l l / W K T P a r s e r . g i t ' , : c o m m i t = > ' e 7 c 3 3 0 2 4 '
  11. LOCAL DEPENDENCIES LOCAL DEPENDENCIES LOCAL DEPENDENCIES p o d '

    S e n s i b l e T a b l e V i e w ' , : l o c a l = > " v e n d o r / f r a m e w o r k s / S T V 3 . 1 . 4 P r o / S o u r c e C o d e / S e n s i b l e T a b l e V i e w / "
  12. SHIPPING A PODSPEC SHIPPING A PODSPEC SHIPPING A PODSPEC p

    o d s p e c c r e a t e ' Y o u r L i b r a r y '
  13. A SIMPLE PODSPEC A SIMPLE PODSPEC A SIMPLE PODSPEC P

    o d : : S p e c . n e w d o | s | s . n a m e = ' S e n s i b l e T a b l e V i e w ' s . v e r s i o n = ' 3 . 1 . 4 ' s . p l a t f o r m = : i o s s . i o s . d e p l o y m e n t _ t a r g e t = ' 5 . 0 ' s . p r e f i x _ h e a d e r _ f i l e = ' S e n s i b l e T a b l e V i e w / S e n s i b l e T a b l e V i e w - P r e f i x . p c h ' s . s o u r c e _ f i l e s = ' S e n s i b l e T a b l e V i e w / S T V - C o r e / * . { h , m } ' s . r e q u i r e s _ a r c = t r u e e n d
  14. THANKS! THANKS! THANKS! Peter Kananen Peter Kananen Peter Kananen @pkananen

    @pkananen @pkananen CocoaPods Primer Shipping a CocoaPod