Last active
March 28, 2020 23:42
-
-
Save SwiftyAlex/732feeeaddb56dcaebf2c26c95116885 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
@propertyWrapper | |
class Title { | |
var wrappedValue: UILabel | |
init(text: String) { | |
self.wrappedValue = UILabel() | |
wrappedValue.text = text | |
configureLabel() | |
} | |
private func configureLabel() { | |
wrappedValue.font = UIFont.preferredFont(forTextStyle: .title1) | |
wrappedValue.textColor = UIColor(named: "textColor") | |
wrappedValue.numberOfLines = 1 | |
} | |
} | |
// Usage | |
@Title(text: "Home") | |
var titleLabel: UILabel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment