Skip to content

Instantly share code, notes, and snippets.

@matteodanelli
Created January 9, 2018 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matteodanelli/81d80d880b9e4f8c095d15c1a83f43e7 to your computer and use it in GitHub Desktop.
Save matteodanelli/81d80d880b9e4f8c095d15c1a83f43e7 to your computer and use it in GitHub Desktop.
Swift selectors
fileprivate extension Selector {
static let buttonTapped = #selector(ViewController.buttonTapped)
static let deviceOrientationDidChange = #selector(ViewController.deviceOrientationDidChange)
}
// Example on how to use it
NotificationCenter.default.addObserver(self, selector: .deviceOrientationDidChange,
name: NSNotification.Name.UIDeviceOrientationDidChange,
object: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment