-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] Write "collator" wrappers for NSExpression #12269
Comments
There are a few pieces to implement here:
|
I'm not sure of all the terminology here, but currently a |
OK, that makes sense. So the most common way to perform a case-insensitive, locale-sensitive comparison in Objective-C or Swift would be: NSPredicate(format: "name_fr =[cl] 'quebec'") Note how As it is, it’s already possible, if ugly, to create a NSPredicate(format: "MGL_FUNCTION('==', name_fr, 'quebec', MGL_FUNCTION('collator', %@))",
["case-sensitive": false, "diacritic-sensitive": true, "locale": "en"]) So far we’ve only defined aftermarket expression functions for the most common operators, but we could define one for creating a collator, with a syntax like this: NSPredicate(format: "MGL_FUNCTION('==', name_fr, 'quebec',
collatorCaseInsensitive:diacriticInsensitive:locale:(TRUE, FALSE, 'en'))") But more likely, we’d have operators like NSPredicate(format: "MGL_FUNCTION('==', name_fr, 'quebec', %@)",
["case-sensitive": false, "diacritic-sensitive": true, "locale": "en"]) If we encounter a |
The |
Follow-on for #11869: ios/macos now support "collator" expressions, but they're not directly exposed via the SDK. Collator expressions take a dictionary-style object as an argument, e.g.:
["collator", {"case-sensitive": false, "diacritic-sensitive": true, "locale": "en"}]
This is a new pattern so we'll have to figure out the right iOS/macOS way to expose it.
/cc @1ec5 @friedbunny @julianrex
The text was updated successfully, but these errors were encountered: