Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JayachandraA/ba1b8f67f380d7f88721792fd30d5c2a to your computer and use it in GitHub Desktop.
Save JayachandraA/ba1b8f67f380d7f88721792fd30d5c2a to your computer and use it in GitHub Desktop.
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