Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

With the new architecture, you can't have a variable for an Amazing instance #33

Open
ipodishima opened this issue Nov 22, 2018 · 2 comments

Comments

@ipodishima
Copy link

ipodishima commented Nov 22, 2018

Hi there!

Thanks for the library, very helpful for my project!
But...
Given the update on Amazing (public protocol Amazing: RawRepresentable, CaseIterable where RawValue == String) we could write

var icon: Amazing {
        switch self {
        case .conversations:
            return AwesomePro.Regular.comment
        case .statistics:
            return AwesomePro.Solid.chartPie
        }
    }

Now we can't :(
Protocol 'Amazing' can only be used as a generic constraint because it has Self or associated type requirements

@padarom
Copy link
Contributor

padarom commented Nov 24, 2018

@rafiki270 @ghowen Any ideas? In extensions we use the generic <AmazingType: Amazing>, but as far as I know we can't do that with variable types, plus it would hurt readability for the API consumer.

@ghost ghost mentioned this issue Nov 24, 2018
@rafiki270
Copy link
Collaborator

Well, as a quick hack I would suggest you return another type for now ... like image or attributed string. I’ll try to check some options about this asap

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants