Let's say I have a standard style defined like this which is used in multiple scenes on multiple places.
static let defaultRegular12CoolGrey = TextStyle(
.font(.defaultRegular12),
.foregroundColor(.coolGrey)
)
One of those places is to style raw html from api. Here I need to inject styling html header, where I need separate color and separate font. Currently I have to type the attribute:
let color = TextStyle.defaultRegular12CoolGrey.attributes[.foregroundColor] as? UIColor
It is not Swifty that attributes[.attribute] returns Any. It should return exact type. So that we could write directly
let color = TextStyle.defaultRegular12CoolGrey.attributes[.foregroundColor] //color is optional UIColor