Created
October 21, 2015 08:33
-
-
Save onevcat/cae76eb3f2606406e355 to your computer and use it in GitHub Desktop.
Extension
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
extension UILabel { | |
@IBInspectable var localizedKey: String? { | |
set { | |
if let s = newValue { | |
text = NSLocalizedString(s, comment:"") | |
} | |
} | |
get { | |
return text | |
} | |
} | |
} | |
extension UIButton { | |
@IBInspectable var localizedKey: String? { | |
set { | |
if let s = newValue { | |
setTitle(NSLocalizedString(s, comment:""), forState: .Normal) | |
} | |
} | |
get { | |
return titleLabel?.text | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment