Created
October 4, 2017 05:18
-
-
Save DaveWoodCom/440a56eba929b79a79a16bc02fb1beaa to your computer and use it in GitHub Desktop.
`post_install` hook to set the Swift version of pods (add to the end of your project's podfile)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post_install do |installer| | |
print "Setting the default SWIFT_VERSION to 4.0\n" | |
installer.pods_project.build_configurations.each do |config| | |
config.build_settings['SWIFT_VERSION'] = '4.0' | |
end | |
installer.pods_project.targets.each do |target| | |
if ['SomeTarget-iOS', 'SomeTarget-watchOS'].include? "#{target}" | |
print "Setting #{target}'s SWIFT_VERSION to 3.0\n" | |
target.build_configurations.each do |config| | |
config.build_settings['SWIFT_VERSION'] = '3.0' | |
end | |
else | |
print "Setting #{target}'s SWIFT_VERSION to Undefined (Xcode will automatically resolve)\n" | |
target.build_configurations.each do |config| | |
config.build_settings.delete('SWIFT_VERSION') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment