问题
I've been using SwiftyJSON and Alamofire in a project. Recently I downloaded XCode 7 beta. Both SwiftyJSON and Alamofire have separate, non-master branches for Swift 2. Is there a way to get these via CocoaPods, or do I need to install them in the traditional way?
I tried searching on the CocoaPods website to see if these branches had been submitted as separate Pods, but nothing came up. I'm wondering if there is a Podfile syntax that allows you to get a non-master branch.
回答1:
You can specify any branch from the repository in your Podfile.
Example I'm using for Alamofire:
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift-2.0'
Change the line(s) in your Podfile then run pod install
again.
There's also this alternative syntax:
pod 'Alamofire', git: 'https://github.com/Alamofire/Alamofire.git', branch: 'swift-2.0'
回答2:
Update to the current answer. The line above now returns git errors complaining that the 'swift-2.0' branch is not found. Use this form instead:
pod 'Alamofire', '~> 2.0'
来源:https://stackoverflow.com/questions/31334205/getting-non-master-branch-from-cocoapods