Skip to content

Iterate over all icons? #66

@Miodec

Description

@Miodec

Im looking to create an icon picker, and tried this:

ForEach(Awesome.Brand) { item in
    //
}

But this gives an error: Cannot convert value of type 'Awesome.Brand.Type' to expected argument type 'Range<Int>'

I also tried:

private var icons = [Awesome.Brand.apple, Awesome.Brand.google]

...

ForEach(icons) { item in
    ///
}

But that gives another error: Referencing initializer 'init(_:content:)' on 'ForEach' requires that 'Awesome.Brand' conform to 'Identifiable'

Is there anyway to do this? Could the creator just add Identifiable to the icon groups? Im still new so not sure if that's the solution here.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions