Slide 1

Slide 1 text

Seed Your O wn CocoaPod Fabio Pelosin @fabiopelosin / irrationalfab

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

CocoaPods manages library dependencies for your Xcode projects.

Slide 4

Slide 4 text

Ultimately the goal is to improve discoverability of, and engagement in, third party open-source libraries by creating a more centralized ecosystem.

Slide 5

Slide 5 text

Pod additions per day 750 1500 2250 3000 0 200 400 600 800

Slide 6

Slide 6 text

Pod additions per day 750 1500 2250 3000 0 200 400 600 800 R² 0,9993

Slide 7

Slide 7 text

2669 Pods Almost 8 Pods per day in the last month

Slide 8

Slide 8 text

2,2 Years 270.000 Gem Downloads 4.000 Pull Requests 7.300 Podspecs 1.706 Contributors 16.000 Commits

Slide 9

Slide 9 text

16.000 Commits ! Assuming 3 minutes per commit this is equivalent to 2.000 hours More than 5 years!

Slide 10

Slide 10 text

More than 10 projects

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

1706 contributors

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Getting started with CocoaPods

Slide 21

Slide 21 text

$ [sudo] gem install cocoapods $ pod --version Installing CocoaPods

Slide 22

Slide 22 text

Use `sudo` during the installation only if strictly needed.

Slide 23

Slide 23 text

Never use `sudo` while launching the `pod` executable!

Slide 24

Slide 24 text

Simplified installation which doesn’t require the Xcode command line tools anymore.

Slide 25

Slide 25 text

$ cd project_dir $ pod init # Close the project # Add least one dependency to your Podfile $ pod install # Check that CocoaPods doesn’t print any warning # Open the workspace # Check that your integrated target builds Integrating a target

Slide 26

Slide 26 text

target 'Marshmallow' do pod 'AFNetworking', '~> 2.0' pod 'ObjectiveSugar', '~> 0.5' end The Podfile

Slide 27

Slide 27 text

Use the optimistic `~>` operator.

Slide 28

Slide 28 text

Treat your Pods as external frameworks and namespace the imports. E.g. `#import `

Slide 29

Slide 29 text

Migration to CocoaPods • Can be performed incrementally. • You can install each new dependency and then check that the system works until you have enough confidence. • Should be pretty straightforward if a Pod is available for your libraries.

Slide 30

Slide 30 text

$ git clone https://github.com/AFNetworking/AFNetworking.git $ edit Podfile # pod 'AFNetworking', :path => '~/code/AFNetworking' $ pod install The Path option

Slide 31

Slide 31 text

Never edit a Pod which doesn’t uses the path option.

Slide 32

Slide 32 text

Contribute back to libraries!

Slide 33

Slide 33 text

Seeding your own Pod

Slide 34

Slide 34 text

$ pod lib create MyAwesomePod $ cd MyAwesomePod # Create the project # Copy or create your classes # Configure MyAwesomePod.podspec # Integrate it with CocoaPods $ edit Podfile # pod 'MyAwesomePod', :path => '~/code/MyAwesomePod' $ pod install Creating a new Pod

Slide 35

Slide 35 text

Pod::Spec.new do |s| s.name = 'Reachability' s.version = '3.1.0' s.license = :type => 'BSD' s.homepage = 'https://github.com/tonymillion/Reachability' s.authors = 'Tony Million' => '[email protected]' s.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.' s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' } s.source_files = 'Reachability.h,m' s.framework = 'SystemConfiguration' s.requires_arc = true end A specification

Slide 36

Slide 36 text

$ pod spec lint MyAwesomePod/MyAwesomePod.podspec Linting $ cd MyAwesomePod $ pod lib lint

Slide 37

Slide 37 text

Use`$ pod lib lint`.

Slide 38

Slide 38 text

Use Semantic Versioning 2.0.0 for your libraries.

Slide 39

Slide 39 text

Document your Pod

Slide 40

Slide 40 text

$ pod push master MyAwesomePod/MyAwesomePod.podspec Pushing to the master repo

Slide 41

Slide 41 text

Release an open source Pod without a proper license.

Slide 42

Slide 42 text

Reasons to use CocoaPods even for private libraries

Slide 43

Slide 43 text

View of the application as the glue layer Encapsulations of unit tests

Slide 44

Slide 44 text

Better encapsulation of code Reusability Dependencies

Slide 45

Slide 45 text

Paves out the way for open source publication (which in some cases makes sense)

Slide 46

Slide 46 text

Convenience Leaner development with the creation of Demo targets Clear identification of which version of a library/source code is used

Slide 47

Slide 47 text

$ pod repo add MYPrivateRepo SOURCE_URL $ pod push MYPrivateRepo MyAwesomePod/MyAwesomePod.podspec Private repos

Slide 48

Slide 48 text

irrationalfab @fabiopelosin

Slide 49

Slide 49 text

How CocoaPods works

Slide 50

Slide 50 text

Pod source files Pods target User Target xcconfig

Slide 51

Slide 51 text

CocoaPods main tasks • Creates the workspace. • Creates the Pods project. • Adds the relative Pod target to your library link in the binaries build phase. • Configures your library with the xcconfigs. • Does some other minor house keeping.

Slide 52

Slide 52 text

No content