Post

Replies

Boosts

Views

Activity

Comment on Filtering array of strings - dealing with unclear "type Bool?" error
That did it. Thanks. For future clueless people like me, let me answer your questions to make Claude31 answer even more useful: orangePlayerName is the String being inputted in the textField. It wouldn't be empty when it gets to the code above. fetchNames returned [String?] through NSFetchRequest with a .map(.name) to extract just the name attribute out of an entity from Core Data. Xcode wanted to insert/remove the "!" after "hasPrefix(orangePlayerName)".
Jun ’22
Comment on Filtering array of strings - dealing with unclear "type Bool?" error
That did it. To answer Claude31 questions for future reference: fetchNames comes from an NSFetchRequest with a .map(.name) to extract the name attribute from a Core Data entity. It returns [String?]. orangePlayerName is the String being inputted in the textField. Must not empty to trigger the autocomplete popover. Xcode inserted/removed "!" after "hasPrefix(orangePlayerName)". Error was obviously potentially empty array from fetchNames. I thought the "?" in "$0?" took care of that. I was wrong.
Jun ’22
Comment on Displaying Core Data entity in Table (iOS 16)
Thanks deeje. A few followups. How do I use fetchrequest to resort? Do I put it another inside the .onChange modifier? Wouldn’t you want to minimize the number of fetchrequests? To get data from cloud again just to re-sort seems wasteful. Finally, I don’t expect lots of data at all. But how do you optimize a table for that? thanks again.
Sep ’22