Slide 1

Slide 1 text

CocoaPods A better way to use and publish open source project for Objective-C

Slide 2

Slide 2 text

Francis Chong @siuying

Slide 3

Slide 3 text

Cocoa

Slide 4

Slide 4 text

A cocoa pod http://en.wikipedia.org/wiki/Cocoa_bean

Slide 5

Slide 5 text

cocoapods.org “CocoaPods is the dependency manager for Objective-C projects.”

Slide 6

Slide 6 text

Dependency Manager

Slide 7

Slide 7 text

dependency?

Slide 8

Slide 8 text

System Frameworks

Slide 9

Slide 9 text

Reusable Components

Slide 10

Slide 10 text

Third Party Code

Slide 11

Slide 11 text

Manage Dependency, the old way

Slide 12

Slide 12 text

“Drag the *.h and *.m file to Xcode”

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Static Library

Slide 15

Slide 15 text

Frameworks

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

“dependency hell”

Slide 18

Slide 18 text

A -> C (version 1) B -> C (version 2)

Slide 19

Slide 19 text

A -> C (version 1) B -> C (version 2) C -> D (version 3) E -> D (version 4) F -> B (version 5)

Slide 20

Slide 20 text

Better way to manage dependency?

Slide 21

Slide 21 text

rubygems pip npm

Slide 22

Slide 22 text

CocoaPods Basic

Slide 23

Slide 23 text

Installation

Slide 24

Slide 24 text

sudo gem install cocoapods

Slide 25

Slide 25 text

pod setup

Slide 26

Slide 26 text

Project Setup

Slide 27

Slide 27 text

cd MyApp! pod init

Slide 28

Slide 28 text

Podfile

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

“The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects.” cocoapods.org

Slide 31

Slide 31 text

DSL for dependencies

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Podspecs

Slide 38

Slide 38 text

“A Podspec, or Spec, describes a version of a Pod library.” cocoapods.org

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Repo

Slide 44

Slide 44 text

“The Specs Repo is git repository that contains the list of available pods.” cocoapods.org

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

“Every library has an individual folder, which contains sub folders of the available versions of that pod. ”

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Install Dependencies

Slide 49

Slide 49 text

pod install

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

What happened when you run pod install ?

Slide 52

Slide 52 text

Update Podspecs Repo

Slide 53

Slide 53 text

Resolve Dependency

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Semantic Versioning http://semver.org/

Slide 56

Slide 56 text

1.6.4 MAJOR.MINOR.PATCH

Slide 57

Slide 57 text

MAJOR - incompatible API changes

Slide 58

Slide 58 text

MINOR - add functionality in a backwards-compatible manner

Slide 59

Slide 59 text

PATCH - backwards- compatible bug fixes.

Slide 60

Slide 60 text

1.6.4 MAJOR.MINOR.PATCH

Slide 61

Slide 61 text

Download Dependencies

Slide 62

Slide 62 text

git hg svn bzr http

Slide 63

Slide 63 text

Generate Pods project

Slide 64

Slide 64 text

Generate workspace

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Advance Topics

Slide 67

Slide 67 text

Making a CocoaPod

Slide 68

Slide 68 text

pod spec create MyLibrary

Slide 69

Slide 69 text

MyLibrary.podspec

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

pod lib create MyLibrary

Slide 72

Slide 72 text

!"" Assets! !"" Classes! #"" ios! #"" osx! !"" Resources! !"" Example! #"" Podfile! !"" CHANGELOG.md! !"" LICENSE! !"" README.md! #"" MyLibrary.podspec!

Slide 73

Slide 73 text

MyLibrary.podspec

Slide 74

Slide 74 text

README.md CHANGELOG.md LICENSE

Slide 75

Slide 75 text

Example/Podfile

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Release Pod

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Publish your pod to public Repo

Slide 80

Slide 80 text

Fork the CocoaPods/ Specs repo

Slide 81

Slide 81 text

.! !"" Specs! #"" [SPEC_NAME]! #"" [VERSION]! #"" [SPEC_NAME].podspec

Slide 82

Slide 82 text

.! !"" MyLibrary! #"" 0.1.0! #"" MyLibrary.podspec! #"" 0.2.0! #"" MyLibrary.podspec

Slide 83

Slide 83 text

Send a Pull Request

Slide 84

Slide 84 text

Your Private Pods

Slide 85

Slide 85 text

Specify your own Podspec

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

Create Your Repo

Slide 89

Slide 89 text

.! !"" Specs! #"" [SPEC_NAME]! #"" [VERSION]! #"" [SPEC_NAME].podspec

Slide 90

Slide 90 text

pod repo add REPO_NAME SOURCE_URL!

Slide 91

Slide 91 text

CocoaPods Today

Slide 92

Slide 92 text

0.29.0

Slide 93

Slide 93 text

4227 Pods 12372 Versions

Slide 94

Slide 94 text

Most merged pull request #2 http://octoverse.github.com/

Slide 95

Slide 95 text

CocoaPods Bug Bash http://blog.cocoapods.org/CocoaPods-Bug-Bash/

Slide 96

Slide 96 text

Learn from CocoaPods

Slide 97

Slide 97 text

Automation

Slide 98

Slide 98 text

Use existing infrastructure and tools

Slide 99

Slide 99 text

Build a MVP

Slide 100

Slide 100 text

Embrace opensource

Slide 101

Slide 101 text

Francis Chong @siuying

Slide 102

Slide 102 text

Readings • CocoaPods Guide • Semantic Versioning • iOS Static Libraries Are, Like, Really Bad, And Stuff • kstenerud/iOS-Universal-Framework