Created
January 9, 2018 15:12
-
-
Save matteodanelli/81d80d880b9e4f8c095d15c1a83f43e7 to your computer and use it in GitHub Desktop.
Swift selectors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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