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
Post a Comment