2

Since updating to Swift 3, I've had trouble getting the Swift 3 versions of pods to install. As an example, ReadabilityKit has Swift 3 support on master branch. In their readme, they state that for Swift 3 support, you must simply do:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'ReadabilityKit'
end

I also include the line: source 'https://github.com/CocoaPods/Specs.git' at the top of the podfile.

The problem I'm seeing, which I've replicated on a fresh new Swift 3 project, is that when I do pod install, I get an older version of the repo. So when opening the project it in Xcode, it offers to convert the pod's code to Swift 3, or if I build then it throws a bunch of errors because it's not in Swift 3. I end up having to list it in the podfile like so:

pod 'ReadabilityKit', :git => 'https://github.com/exyte/ReadabilityKit.git', :branch => 'master'`

Which is the default setup - the regular repo, on the master branch. But only now, once I run pod install, does it show that it's ugpraded the pod, and it works as it should. This is not unique to ReadabilityKit - it's happened on every pod with Swift 3 support that I've tried so far.

I'm using Cocoapods 1.0.1, on Ruby 2.3.0.

Andrew
  • 7,693
  • 11
  • 43
  • 81

1 Answers1

3

you can try adding this line to the end of your podfile:

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

Or try to update cocoapods to prerelease version:

sudo gem install cocoapods --pre
Dule
  • 489
  • 5
  • 14
  • 1
    just realized that cocoapods says to use prerelase for Xcode 8 on its [website](https://cocoapods.org/) – Dule Oct 01 '16 at 23:05