iOS CocoaPods - kgleong/software-engineering GitHub Wiki

Cocoa Pods

Search for third party packages at https://cocoapods.org/.

Adding CocoaPods to an iOS app

  • Add a Podfile to the root app directory
    • run pod init
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

# Uncomment this line if you're using Swift
use_frameworks!

target 'MyApp' do
  pod 'Alamofire', '~> 4.0'
  pod 'AFNetworking', '~> 3.0'
  pod 'MBProgressHUD', '~> 1.0.0'
  pod 'SwiftLint'
end
  • run pod install

References

Creating a Pod

pod lib create <module name>

Troubleshooting

# Clears the Xcode project cache
rm -rf ~/Library/Developer/Xcode/DerivedData/

# Clears the pod cache
pod cache clean --all

Versioning

Use the following convention when versioning: MAJOR.MINOR.PATCH

Position Description
MAJOR incompatible API changes have been made.
MINOR functionality has been added, and backwards-compatibility has been maintained
PATCH backwards-compatible fixes have been incorporated

Updating a Pod

  1. Make changes
  2. Update version in .podspec file.
  3. Run pod lib lint to run the linter on the local changes.
  4. Commit changes and tag commit with git tag <version>
  5. Push tag and commit to remote:
    • git push origin master
    • git push origin --tags
  6. Run pod spec lint <Pod name>.podspec to validate the Pod's configuration
  7. Push to CocoaPods: pod trunk push <Pod name>.podspec

References

⚠️ **GitHub.com Fallback** ⚠️