What is the purpose of Iteratable, exactly?
Sweeper777 opened this issue · comments
In the README, there is an example of how to use Iteratable
. But I don't get the point of this protocol. From the example, it seems like that Iteratable
is used to get all the values of an enum. But If that's the case, why not return an array instead? Is there any other uses for Iteratable
?
The purpose is exactly what you said, it's just a helper to get iterate in the enums values. That means, it's the user who will decide which collection will be returned, or how it will be mapped. Having directly the array is less generic, too restrictive.
Beside that, I'm not against adding a computed property returning directly the array to make it easier for a basic usage.
Thanks for the info!