Skip to content

Instantly share code, notes, and snippets.

@DaveWoodCom
Created October 4, 2017 05:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save DaveWoodCom/440a56eba929b79a79a16bc02fb1beaa to your computer and use it in GitHub Desktop.
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)
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