Skip to content

Instantly share code, notes, and snippets.

@foxicode
Created February 5, 2023 18:53
Show Gist options
  • Select an option

  • Save foxicode/eadf249694846a51dff23ff2c9d5593f to your computer and use it in GitHub Desktop.

Select an option

Save foxicode/eadf249694846a51dff23ff2c9d5593f to your computer and use it in GitHub Desktop.
PropertyWrapper styles
import UIKit
@propertyWrapper
struct HeaderStyle {
var wrappedValue: UILabel
init(_ label: UILabel = .init()) {
label.numberOfLines = 0
label.font = UIFont(name: "Helvetica Neue", size: 32)
label.textColor = UIColor(red: 0.16, green: 0.16, blue: 0.16, alpha: 1.00)
wrappedValue = label
}
}
import UIKit
@propertyWrapper
struct ParagraphStyle {
var wrappedValue: UILabel
init(_ label: UILabel = .init()) {
label.numberOfLines = 0
label.font = UIFont(name: "Georgia", size: 20)
label.textColor = UIColor(red: 0.16, green: 0.16, blue: 0.16, alpha: 1.00)
wrappedValue = label
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment