I just want to try Swift 3.0 in one of my projects. Xcode open the migration window to update my project to use Swift 3.0.
The problem is, I just want to to update my project, and leave the Pods project untouched because any changes will be discard after I run the pod install
again.
Anyone already have a solution for that?
As of writing, the Swift Package Manager (SPM) is in "early design and development" [1]. It does not currently support iOS, watch OS, or Objective-C [2][3]. CocoaPods will continue development supporting both Swift and Objective-C while SPM develops.
Cocoapods and SwiftPM are some of the most popular package managers. By supporting both in your open-source library, you potentially increase the developers who will use it. 🚨Remember the most important thing all package managers want to know is where are the source files in order to distribute them.
1.11. 0. beta. 1 - August 09, 2021 (286 KB)
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.
Just use the following commands in the end of your podfile and it sets up your pods file to have the frameworks take the swift 3 compiler or legacy compiler automatically so you do not get the cannot use swift 2.1 in swift 3 and errors like that.
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
Using this, have a look at the following example of my podfile. Just make sure the end statement is not before the block I have written above.
platform :ios, '8.0'
use_frameworks!
target 'Project 1'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
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
This might help Swift migration guide
Straight from Swift.org
Using Carthage/CocoaPods Projects
If you are using binary Swift modules from other projects that are not built along with your project in your Xcode workspace, you can choose from one of the following migration strategies:
Wait until the upstream open-source project updates to Swift 2.3 or Swift 3
You can follow this workflow for migrating your project:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With