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

Allow typed access to style attributes #75

Open
VilemKurz opened this issue Jun 18, 2018 · 0 comments
Open

Allow typed access to style attributes #75

VilemKurz opened this issue Jun 18, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@VilemKurz
Copy link

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
@jakubpetrik jakubpetrik self-assigned this Nov 27, 2018
@jakubpetrik jakubpetrik added the enhancement New feature or request label Nov 27, 2018
@jakubpetrik jakubpetrik added this to the 1.0.0 milestone Nov 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants