Post

Replies

Boosts

Views

Activity

Comment on Access a raw value for pure enum without using associated type
@Claude31 I do that thank you... as shown in my OP in the for name in setSorted {} loop. It works perfectly however elsewhere I've been able to whittle that down to a single line - for clarity and as an example - in the second enum above, from the switch through four cases, to the single line EntityDateFormat(rawValue: format)?. Honestly its me being pedantic and trying to better understand enums at the same time. I have a working solution, I just want to make it better. In my humble opinion a single line call to Taxon(rawValue:) is a much more elegant solution than switching through all eight cases, but I'm missing something in my understanding of enums to be able to achieve this. Again as a way of attempting to better explain my problem, I'm hoping to remove the switch statement from the for name in setSorted {} loop and replace it with a single line similar to let nameFormatted = Taxon(rawValue: nameType).formatted(nameComp) but that is probably not the correct syntax?
Topic: App & System Services SubTopic: General Tags:
Dec ’21
Comment on Access a raw value for pure enum without using associated type
@Claude31 thanks for your answer, greatly appreciate your time and effort. I can achieve the results you're able to obtain... I can switch through and obtain the relevant values and or formatting. What I'm struggling with is how to use an arbitrary value against Taxon to obtain a reference to one case. Perhaps the reverse of what your testing revealed? I'll add another less complicated enum in another answer to demonstrate what I mean...
Topic: App & System Services SubTopic: General Tags:
Dec ’21
Comment on Access a raw value for pure enum without using associated type
@Claude31 I do that thank you... as shown in my OP in the for name in setSorted {} loop. It works perfectly however elsewhere I've been able to whittle that down to a single line - for clarity and as an example - in the second enum above, from the switch through four cases, to the single line EntityDateFormat(rawValue: format)?. Honestly its me being pedantic and trying to better understand enums at the same time. I have a working solution, I just want to make it better. In my humble opinion a single line call to Taxon(rawValue:) is a much more elegant solution than switching through all eight cases, but I'm missing something in my understanding of enums to be able to achieve this. Again as a way of attempting to better explain my problem, I'm hoping to remove the switch statement from the for name in setSorted {} loop and replace it with a single line similar to let nameFormatted = Taxon(rawValue: nameType).formatted(nameComp) but that is probably not the correct syntax?
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’21
Comment on Access a raw value for pure enum without using associated type
@Claude31 thanks for your answer, greatly appreciate your time and effort. I can achieve the results you're able to obtain... I can switch through and obtain the relevant values and or formatting. What I'm struggling with is how to use an arbitrary value against Taxon to obtain a reference to one case. Perhaps the reverse of what your testing revealed? I'll add another less complicated enum in another answer to demonstrate what I mean...
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’21