Created
March 31, 2015 16:45
-
-
Save VojtaStavik/0d0095cf7254f4be2fea to your computer and use it in GitHub Desktop.
This file contains 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
class SSNTextField: UITextField { | |
required init(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) | |
registerForNotifications() | |
} | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
registerForNotifications() | |
} | |
deinit { | |
NSNotificationCenter.defaultCenter().removeObserver(self) | |
} | |
private func registerForNotifications() { | |
NSNotificationCenter.defaultCenter().addObserver(self, selector: "textDidChange", name: "UITextFieldTextDidChangeNotification", object: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment