Skip to content

Instantly share code, notes, and snippets.

@tolpp
Created July 14, 2016 14:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolpp/0c878c9ab87049f2f174bf1a519e1d2e to your computer and use it in GitHub Desktop.
Save tolpp/0c878c9ab87049f2f174bf1a519e1d2e to your computer and use it in GitHub Desktop.
CocoaPods Podfile post_install script for adding swift_version property to targets or pod_project. You can use this post_install script if you are working with pods that not compatible with Swift 3.0.
# set true if all pods in the pod_project needs to be flaggged as swift 2.3
legacy_swift_pods_project = true
# Array for pods that will be flagged as swift version 2.3
# if legacy_swift_pods_project is true, you don't need to add any item in array.
legacy_swift_pods = ['Alamofire']
post_install do |installer|
if legacy_swift_pods_project
installer.pods_project.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
installer.pods_project.targets.each do |target|
if legacy_swift_pods.include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '2.3'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment