Run pod install
In the dependency's target build settings, SWIFT_VERSION should respect the pod's pod_target_ xcconfig setting in podspec file.
For example, in SwifterSwift's podspec file, SWIFT_VERSION is explicitly set to 4.0 (https://github.com/SwifterSwift/SwifterSwift/blob/master/SwifterSwift.podspec#L24),
but when I use SwifterSwift in my project, after I run pod install then open the workspace, the SWIFT_VERSION setting of SwifterSwift target should be 4.0 (but it's not).

Continue with the example with SwifterSwift, the SWIFT_VERSION setting of SwifterSwift target should be 4.0, because podspec explicitly said that SwifterSwift wants to be compiled with Swift 4.0. But the SWIFT_VERSION setting is set to 3.2. Seems the xcconfig is generated, but in such a low priority so that being overridden by some default config?
CocoaPods : 1.3.1
Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
RubyGems : 2.6.11
Host : Mac OS X 10.13.2 (17C205)
Xcode : 9.2 (9C40b)
Git : git version 2.14.3 (Apple Git-98)
Ruby lib dir : /usr/local/Cellar/ruby/2.4.1_1/lib
Repositories : axxess-mi-axxessprivaterepo - ssh://stash.axxess.net/mi/axxessprivaterepo.git @ f7e6a2e5cb7f3f0781cb31ab24211e8e8135d008
master - https://github.com/CocoaPods/Specs.git @ 2f9ce3c53d367361ae24c6d3867aeb76a026ef4b
Executable Path: /usr/local/bin/pod
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'PodTarget' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for PodTarget
pod 'SwifterSwift'
end
Please extract the project and run pod install.
The setting was overridden by the Pods project building setting. Looks like Cocoapods writes SWIFT_VERSION = 3.0 for every target in Pods project file.
I tried to change SWIFT_VERSION of the main project, and Cocoapods is writing the same SWIFT_VERSION setting to all pod targets. This doesn't makes sense, this makes SWIFT_VERSION setting in podspec.pod_target_xcconfig meaningless, because it's going to be overridden.
There is a new DSL in 1.4.0.rc.1 s.swift_version to use for this.
Please use 1.4.0.rc.1 or wait for 1.4.0 to ship which hopefully should be next week.
Going to close as already "fixed".
@dnkoutso Just finished read the long issue #6791 , and realized that we've already solved this. Thanks a lot!
Hey @dnkoutso, quick question: What is the default behavior if an existing pod doesn't have s.swift_version?
ex: we have a bunch of private pods that are currently in 3.2. We're releasing new versions of those pods that specify s.swift_version = '4.0'. It looks like pods that don't have this new property are also being set to 4.0 (perhaps inheriting from the project)
is that expected?
@iwllyu I think so, for pods without swift_version specified, they are set with the same version as the main project.
@iwllyu if there is no swift_version specified then the Swift Version of your app target is used.
Code:
# @return [String] the Swift version for the target. If the pod author has provided a swift version
# then that is the one returned, otherwise the Swift version is determined by the user
# targets that include this pod target.
#
def swift_version
spec_swift_version || target_definitions.map(&:swift_version).compact.uniq.first
end
thanks for the quick answers, both of you
Most helpful comment
There is a new DSL in 1.4.0.rc.1
s.swift_versionto use for this.Please use 1.4.0.rc.1 or wait for 1.4.0 to ship which hopefully should be next week.
Going to close as already "fixed".