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?
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...
Dec ’21
Comment on Using Core Data in a new to macOS 12 (beta) `Table`
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).
Sep ’21
Comment on Performance of selecting table rows
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.
Sep ’21
Comment on SwiftUI TextField present integer (Int64) for macOS target
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.
Aug ’21