I’m upgrading a CocoaPod to Swift 3. It compiles and runs just fine, but pod lib lint
fails with numerous compiler errors, because the linter tries to compile everything as Swift 2.3.
Attempts to set SWIFT_VERSION
in the podspec or change “Use Legacy Swift Language Version” in my framework’s Xcode project do not solve the issue.
How do I make the pod linter use Swift 3?
First you have to update cocoapods to 1.1.0.rc.2 by
[sudo] gem install cocoapods --pre
then as Paul Cantrell says, do
echo 3.0 > .swift-version
in the same dir where the pod spec is
It turns out CocoaPods now looks for a .swift-version
file, as of 1.1.0.rc.2 (changelog). If the file contains 3.0
, linting will work:
echo 3.0 > .swift-version
I have this issue when develop SDK which is depending on socket.io-Client-Swift. After type
echo 3.0 > .swift-version
still don't fix my problem.
However, I noticed pod lint use xcodebuild to test whether the framework is ready to be release without error. Make sure you use Xcode8 to build pod lint. For some reason, I install both Xcode7 & Xcode8 and changed my xcodebuild path to xcode7, so the lint won't be pass when I want to make a framework with swift 3.
use the following code to make sure your xcode setting is right.
xcode-select -print-path
if the xcode-select path is not point to xcode8, you should using
xcode-select -switch <path>
set the xcode-select path to xcode8 which is usually in your Applications.
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