简体   繁体   中英

filterUsingPredicate in swift gives error “Void is not convertible to NSArray”

Hello I am not able to solve this error. please give me the relevant code for this

var predicate = NSPredicate(format: "offerTitle LIKE[cd] %@", regionName);
 var arrRegion : [NSArray] = arrOffers.filterUsingPredicate(predicate);

Second line gives error : " void convertible to NSArray "

filterUsingPredicate modifies a (mutable) array and does not return a result. What you probably want is

var arrRegion : NSArray = arrOffers.filteredArrayUsingPredicate(predicate)

which does not modify the receiver, but returns the filtered array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM