Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankrausch/572a3368c50b77be854265a8c91a77b2 to your computer and use it in GitHub Desktop.
Save frankrausch/572a3368c50b77be854265a8c91a77b2 to your computer and use it in GitHub Desktop.
Convert UIKeyCommand from deprecated init syntax to iOS 13 SDK syntax
# Regex:
UIKeyCommand\(input: (.+)\, modifierFlags: (.+), action: #selector\((.+)\), discoverabilityTitle: (.+)\),
# Replace:
UIKeyCommand(title: $4,
image: nil,
action: #selector($3),
input: $1,
modifierFlags: $2,
propertyList: nil,
alternates: [],
discoverabilityTitle: nil,
attributes: [],
state: .off),
@douglashill
Copy link

Most of those parameters are default values if you want to trim it down a bit.

@frankrausch
Copy link
Author

Ha, I got the new parameters from the Xcode autocomplete and didn’t bother to look more closely. Thanks, Douglas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment