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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -