Swift 2 Using Predicate can't get any result on my filter -


what doing wrong ?

import uikit var values:nsmutablearray  = [] let url = nsurl(string: "url")  // php json result let data = nsdata(contentsofurl: url!) values = try! nsjsonserialization.jsonobjectwithdata(data!, options: nsjsonreadingoptions.mutablecontainers) as! nsmutablearray  var searchtext = "royal"  let resultpredicate = nspredicate(format: "self contains[cd] %@", searchtext) let filteredcars = values.filteredarrayusingpredicate(resultpredicate) 

change code this

let resultpredicate = nspredicate(format: "self.vendor contains[cd] %@ or self.vendor contains[cd] %@ or self.email contains[cd] %@", searchtext, searchtext, searchtext) let filteredcars = values.filteredarrayusingpredicate(resultpredicate) 

you need add key in want filter text.
hope you.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -