如何从特定分支安装 pod?

How to install a pod from a specific branch?

我正在尝试通过 cocoapods 添加 pod,我正在使用 swift 3,而 pod(SQlite.swift).

我正在尝试使用没有掌握最新的 swift 版本,但是有一个 branch for swift 3.

那么我应该如何设置我的podfile来下载特定的分支呢?可能吗?

这是我的播客文件:

platform :ios, '10.0'

target 'RedShirt' do
  use_frameworks!

  # Pods for RedShirt
   pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

podfile guide 提到了以下语法:

To use a different branch of the repo:

pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
                                                                             ^^^
                                                                   (the space is important)

所以在你的情况下,那将是:

pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git', :branch => 'swift3-mariotaku'

如果只想使用主分支(master),写如下命令:

pod "SAConfettiView", :git => 'https://github.com/oskarko/SAConfettiView.git'

但是如果你想使用 alternative/different 分支,这个分支适合你:

pod "SAConfettiView", :git => 'https://github.com/oskarko/SAConfettiView.git', :branch => 'develop'

轻松愉快!