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

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

At Hong Kong Open Source Conference 2014

Ecdf9a83234e21743d77b75fd308b929?s=128

Francis Chong

March 29, 2014
Tweet

Transcript

  1. CocoaPods A better way to use and publish open source

    project for Objective-C
  2. Francis Chong @siuying

  3. Cocoa

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

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

  6. Dependency Manager

  7. dependency?

  8. System Frameworks

  9. Reusable Components

  10. Third Party Code

  11. Manage Dependency, the old way

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

  13. None
  14. Static Library

  15. Frameworks

  16. None
  17. “dependency hell”

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

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

    C -> D (version 3) E -> D (version 4) F -> B (version 5)
  20. Better way to manage dependency?

  21. rubygems pip npm

  22. CocoaPods Basic

  23. Installation

  24. sudo gem install cocoapods

  25. pod setup

  26. Project Setup

  27. cd MyApp! pod init

  28. Podfile

  29. None
  30. “The Podfile is a specification that describes the dependencies of

    the targets of one or more Xcode projects.” cocoapods.org
  31. DSL for dependencies

  32. None
  33. None
  34. None
  35. None
  36. None
  37. Podspecs

  38. “A Podspec, or Spec, describes a version of a Pod

    library.” cocoapods.org
  39. None
  40. None
  41. None
  42. None
  43. Repo

  44. “The Specs Repo is git repository that contains the list

    of available pods.” cocoapods.org
  45. None
  46. “Every library has an individual folder, which contains sub folders

    of the available versions of that pod. ”
  47. None
  48. Install Dependencies

  49. pod install

  50. None
  51. What happened when you run pod install ?

  52. Update Podspecs Repo

  53. Resolve Dependency

  54. None
  55. Semantic Versioning http://semver.org/

  56. 1.6.4 MAJOR.MINOR.PATCH

  57. MAJOR - incompatible API changes

  58. MINOR - add functionality in a backwards-compatible manner

  59. PATCH - backwards- compatible bug fixes.

  60. 1.6.4 MAJOR.MINOR.PATCH

  61. Download Dependencies

  62. git hg svn bzr http

  63. Generate Pods project

  64. Generate workspace

  65. None
  66. Advance Topics

  67. Making a CocoaPod

  68. pod spec create MyLibrary

  69. MyLibrary.podspec

  70. None
  71. pod lib create MyLibrary

  72. !"" Assets! !"" Classes! #"" ios! #"" osx! !"" Resources!

    !"" Example! #"" Podfile! !"" CHANGELOG.md! !"" LICENSE! !"" README.md! #"" MyLibrary.podspec!
  73. MyLibrary.podspec

  74. README.md CHANGELOG.md LICENSE

  75. Example/Podfile

  76. None
  77. Release Pod

  78. None
  79. Publish your pod to public Repo

  80. Fork the CocoaPods/ Specs repo

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

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

    MyLibrary.podspec
  83. Send a Pull Request

  84. Your Private Pods

  85. Specify your own Podspec

  86. None
  87. None
  88. Create Your Repo

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

  90. pod repo add REPO_NAME SOURCE_URL!

  91. CocoaPods Today

  92. 0.29.0

  93. 4227 Pods 12372 Versions

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

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

  96. Learn from CocoaPods

  97. Automation

  98. Use existing infrastructure and tools

  99. Build a MVP

  100. Embrace opensource

  101. Francis Chong @siuying

  102. Readings • CocoaPods Guide • Semantic Versioning • iOS Static

    Libraries Are, Like, Really Bad, And Stuff • kstenerud/iOS-Universal-Framework