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

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -