@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?
Post
Replies
Boosts
Views
Activity
@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...
Thanks for your answer, very helpful and appreciated, however unfortunately does not provide the visual appearance and function that I was hoping for... primarily a cascading style disclosure indicator at every level / for each child.
@Sanook, the reduce method described in the answer here is a good solution and works in my Core Data apps that use @SectionedFetchRequest.
What version of macOS are you running? You might need to set up another computer or another volume on your computer to run other versions of macOS?
Thank you for your answer, greatly appreciated. I have attempted to use this solution. The project builds and runs, but unfortunately still no show for the Table. Switching between records, the two column Table flashes up for only a few microseconds (which it also does for the code in the original post).
Just to double check my data is coming through, I added the following...
Text("\(eventActions.count) ACTIONS")
For an event with 3 actions, this accurately reports this.
Perhaps worth mentioning that I have built the GardenApp code-along tutorial projects and these function as expected. So I suspect that this is either an error in my code structure or a bug (which I have already reported in feedback to Apple).
NOTE: last line of var query: Binding<String> {} should be...
events.nsPredicate = newValue.isEmpty ? predicateArchived : predicateAll
Thank you for explaining the SectionedFetchResults as well as providing an answer that works perfectly!
Garden App does not function as expected for me. Performance is sluggish and my advice is to log a Feedback to Apple and provide a sample project that demonstrates this. One way of ensuring best performance for these beta versions of sample code is to ensure you have the latest beta software installed for both macOS and Xcode. Sometimes that helps.
Thanks for your help @workingdogintokyo appreciated. The getter is not the problem - get: { String(account.sortOrder) } always works. It is the setter that causes the crash because I was a little too lazy with my code and used a force unwrap. This was one way of solving the challenge that arises from my understanding (perhaps incorrect) that all Core Data objects created using CodeGen and for use in Swift are optional by default. I'll post my own answer to include more detail around the issue and a very simple solution.