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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -