Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save biloshkurskyi-ss/d8e95740f40483410bc1f233fcabdb5d to your computer and use it in GitHub Desktop.
Save biloshkurskyi-ss/d8e95740f40483410bc1f233fcabdb5d 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