Cocoapods and Swift 3.0

CocoaPods and Swift 3.0

What you're asking is not possible. Xcode builds your Cocoapods dependencies as well as your project. You cannot mix Swift 2.x and Swift 3 code in the same project or use Cocoapods with Swift 3 that are written in Swift 2.x.

How to update a cocoapod built in Swift 3 to Swift 4

Go to your Pods project, then:

  1. Select the target you want to update
  2. Go into its build settings
  3. Select Swift 3.2 as the language version

Sample Image

How to update pods to Swift 3.0

First of all you need to update your CocaPod if you haven't done it.

Open terminal and run:

sudo gem install cocoapods --pre

Then add the update part to your pod:

pod 'SwiftDate', :git => 'https://github.com/malcommac/SwiftDate.git', :branch => 'feature/swift-3.0'

Then in terminal run pod update

Module compiled with Swift 3.0 cannot be imported in Swift 2.3

You'll need to change the Use Legacy Swift Language Version to NO - this makes sure your project will use swift 3.

If you want to package your project as a POD (for cocoapods) you'll need to add a file named .swift-version (containing 1 single line, "3.0").
This will tell cocoapods to use the swift 3 compiler.

Everything should work after this changes.



Related Topics



Leave a reply



Submit