Benefits of modularisation • Less code to maintain (per module) • Less dependencies • Explicitely declared dependencies • Well defined interface • You can’t be lazy anymore Better maintainability
Benefits of modularisation • Managing dependencies is a nightmare • Multiple modules might have the same dependency • Different modules use different versions of their dependencies • Updating one module requires all dependant modules to update The downside of all of this
CocoaPods • Adds the source code of AFNetworking • Adds all resources of AFNetworking • Adds all dependencies of AFNetworking • Configures your Xcode project The Podfile
CocoaPods • Updates the source code of AFNetworking • Updates all resources of AFNetworking • Updates all dependencies of AFNetworking • Configures your Xcode project The Podfile
CocoaPods • Contains all dependencies a pod has • other pods, libraries, frameworks • Contains the list of public files and resources • Contains the path to the pod and other meta data • version, description, author,… The .podspec
Creating a pod • A pod contains a .podspec file • Contains all the meta data that is necessary • May contain a demo and a test target > pod lib create Essential parts
Semantic Versioning • Dependency management through version numbers • All modules follow the same versioning concept • Great to be used for frameworks and libraries • Not for marketing or application versioning
Semantic Versioning • Used for backwards compatible bug fixes • No new public API • Internal API may change • Fixes internal misbehaviour MAJOR.MINOR.PATCH
Semantic Versioning • Introduces new features or new public API • Introduces deprecations in the public API • May introduce substential internal changes • May contain patch level changes • Patch version must be reset to 0 MAJOR.MINOR.PATCH
Semantic Versioning • Introduces backwards incompatible changes to the public API • May contain minor and patch level changes • Minor and patch version must be reset to 0 MAJOR.MINOR.PATCH
Semantic Versioning • Development starts with 0.1.0 • New features and removed public API: 0.2.0 • Bugfix release: 0.2.1 • First stable version: 1.0.0 • Public method is deprecated: 1.1.0 • New features: 1.2.0 • Bugfix release: 1.2.1 • New version that removes previously deprecated methods: 2.0.0 Example
Semantic Versioning • Modules depend on another modules major version • Minor and patch are just used to get the minimum version • Automatically upgrade to all minor and patch versions Dependency management
The specs repository • A git containing all .podspec files from the supported pods • Used by pod install and pod update • Referenced in the Podfile via the source keyword