Skip to content

Instantly share code, notes, and snippets.

@demonar
Last active September 15, 2015 02:34
Show Gist options
  • Save demonar/f5a7e79b2e7d8e488fe3 to your computer and use it in GitHub Desktop.
Save demonar/f5a7e79b2e7d8e488fe3 to your computer and use it in GitHub Desktop.
import UIKit
private var kAssociationKeyNextField: UInt8 = 0
extension UITextField {
@IBOutlet var nextField: UITextField? {
get {
return objc_getAssociatedObject(self, &kAssociationKeyNextField) as? UITextField
}
set(newField) {
objc_setAssociatedObject(self, &kAssociationKeyNextField, newField, UInt(OBJC_ASSOCIATION_RETAIN))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment