Skip to content
This repository has been archived by the owner on Jun 8, 2020. It is now read-only.

Colors as Computed Properties #12

Closed
Gatada opened this issue Dec 6, 2017 · 2 comments
Closed

Colors as Computed Properties #12

Gatada opened this issue Dec 6, 2017 · 2 comments

Comments

@Gatada
Copy link

Gatada commented Dec 6, 2017

I would prefer seeing the generated colours added as computed properties, as we are simply accessing a defined value of a particular type - and not doing any functional computation or state changing.

@Gatada Gatada changed the title Colors as dynamic vars Colors as Computed Properties Dec 6, 2017
@fernandodelrio
Copy link
Owner

I like the idea. Something like:

extension UIColor {
    /// Color #FFC034 (alpha 255)
    static var myColor: UIColor {
        return UIColor(named: "MyColor") ?? .clear
    }
}

Accessing like:

UIColor.myColor

I will implement it 👍

@fernandodelrio
Copy link
Owner

Done on 0.5.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants