Open AndreyArzhannikov opened 4 years ago
We might use closure based building attributes like this:
func attributed(building: (AttributesBuilder) -> AttributesBuilder) -> NSAttributedString {
attributed(with: building(AttributesBuilder()).attributes)
}
"Some string".attributed {
$0.foreground(color: .black)
.background(color: .blue)
.font(.systemFont(ofSize: 16))
}
aka snapkit style for adding constraints
Currently there is an error when you try to use
.init()
syntax for builder. The following error message is occurred:Expression type 'NSAttributedString' is ambiguous without more context
It's supposed to be swift compiler cannot infer type, so it requires to specify explicit type
Example triggering issue
Environment: