ios - Swift - NSPredicate -
is there cleaner way without having specify searchtext
twice? or best way?
let searchpredicate = nspredicate(format: "self.firstname contains[c] %@ or self.lastname contains[c] %@", argumentarray: [searchtext, searchtext])
in case, think va_arg prototype cleaner array one:
let searchpredicate2 = nspredicate(format: "self.firstname contains[c] %@ or self.lastname contains[c] %@", searchtext, searchtext)
but both case have same result, it's you.
note have third way create predicate: using dictionary. take @ documentation.
Comments
Post a Comment