Created
September 18, 2018 14:31
-
-
Save JayachandraA/ba1b8f67f380d7f88721792fd30d5c2a to your computer and use it in GitHub Desktop.
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
struct AssociatedKeys { | |
static var placeholderColor: String = "placeholderColor" | |
} | |
var placeholderColor: UIColor? { | |
set { | |
objc_setAssociatedObject(self, &AssociatedKeys.placeholderColor, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN) | |
} | |
get { | |
guard let value = objc_getAssociatedObject(self, &AssociatedKeys.placeholderColor) as? UIColor else { return nil } | |
return value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment