Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Allow typed access to style attributes #75

@VilemKurz

Description

@VilemKurz

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions