Skip to content

Instantly share code, notes, and snippets.

@davidahouse
Created September 29, 2016 11:49
Show Gist options
  • Save davidahouse/18dd78bef7ae543117c396f8c950ccfe to your computer and use it in GitHub Desktop.
Save davidahouse/18dd78bef7ae543117c396f8c950ccfe to your computer and use it in GitHub Desktop.
Run the Swift 3 migrator for a project manually from the command line rather than letting Xcode do it
require 'find'
require 'pp'
swift_file_paths = []
Find.find('./') do |path|
if path =~ /.*\.swift$/ and !path.start_with? "./Carthage"
swift_file_paths << path
cmd = "xcrun swift-update -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -target arm64-apple-ios9 #{path} > convert.swift"
system cmd
cmd = "cp convert.swift #{path}"
system cmd
cmd = "rm convert.swift"
system cmd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment