Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CocoaPods Dependency-Management for iOS

CocoaPods Dependency-Management for iOS

CocoaPods (http://cocoapods.org/) ermöglicht es Dependencies in iOS Apps einfach und schnell zu Verwalten und so Libraries einfach und effizient einsetzen zu können. Felix zeigt wie man CocoaPods einsetzt und was man damit alles noch so machen kann.

Felix Schulze

January 21, 2014
Tweet

More Decks by Felix Schulze

Other Decks in Technology

Transcript

  1. Why CocoaPods? • Automate everything! • Save time • Consistant

    workspace • Really easy updates • Automatic dependency resolution • Solid Xcode configs • Divide project and third party library settings • Docs integrated • Easy to integrate
  2. Design • Pod = Dependency / Library • Podfile =

    Description of project dependencies • Podspec = Specification of an Library
  3. Integrate CocoaPods • Create Podfile Analyzing dependencies Downloading dependencies Installing

    AFNetworking (2.1.0) Generating Pods project Integrating client project ! [!] From now on use `PodDemo.xcworkspace`. platform :ios, '6.0' ! pod 'AFNetworking', '2.1.0' • Run pod install
  4. Podfile pod 'AFNetworking', '2.1.0' platform :ios, '6.0' inhibit_all_warnings! ! xcodeproj

    PodDemo.xcodeproj ! pod 'AFNetworking', '2.1.0' pod 'SVProgressHUD', :head ! target :PodDemoTests do pod 'OCMock', '~> 2.2.2' end ! pod 'LocalSourceSpecialPod' :path => 'Libs/LSSP.podspec' pod 'RemoteSourceSpecialPod', :podspec => 'Libs/RSSP.podspec' pod 'RemotePod', :podspec => 'http://goo.gl/HTJ3Ls'
  5. Semantic versions x: Major version • Major API Changes •

    Look for incompatibility y: Minor version • Backward compatible • Changes could be needed z: Patch version • Backward compatible • No changes needed x.y.z
  6. Semantic versions '1.2' Only 1.2 '>1.2' Higher 1.2 '>=1.2' 1.2

    or Higher '<1.2' Lower 1.2 '<=1.2' 1.2 or Lower '~>1.2.1' 1.2.1 or Higher AND Lower 1.3 :head Head version from repo
  7. Podspec Pod::Spec.new do |s| s.name = „AutoScout24 Demo Library" s.version

    = "1.0" s.summary = "Some description" s.homepage = "https://github.com/AutoScout24/DemoLibrary" s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { "Felix Schulze" => "[email protected]" } s.source = { :git => "https://github.com/AutoScout24/DemoLibrary.git", :tag => s.version.to_s } ! s.platform = :ios, '5.0' s.requires_arc = true ! s.source_files = 'ASCDemoLibrary*.{h,m}' s.resources = 'ASCDemoLibrary.bundle' ! s.framework = 'Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore' s.weak_frameworks = 'AdSupport‘ ! s.dependency 'AFNetworking', '~> 1.3' ! end
  8. Examples • ARC vs. Non ARC • AFNetworking 1.x ->

    2.x • OTHER_LINKER_FLAGS • Linked Frameworks • iOS Versions