Post

Replies

Boosts

Views

Activity

Reply to SwiftData #Predicate case insensitive String comparison
Just use the localizedStandardContains(_:) function in your predicate. let predicate = #Predicate<Band> { $0.name.localizedStandardContains(userInput) } This is the most appropriate method for doing user-level string searches, similar to how searches are done generally in the system. The search is locale-aware, case and diacritic insensitive. The exact list of search options applied may change over time. https://developer.apple.com/documentation/swift/stringprotocol/localizedstandardcontains(_:)
Aug ’23