I have a problem with NSPredicate format in Swift, I want to create a predicate that compares an Int value, functioning like "contains" or "LIKE" in String value.
Example :
- 1
- 12
- 31
- 511
If I type 1, then all numbers will be returned to predicate.
This is my line code looks like :
let searchPredicate = NSPredicate(format: "id LIKE %d OR customerName contains %@", searchText, searchText)
I also had tried :
let searchPredicate = NSPredicate(format: "id contains %d OR customerName contains %@", searchText, searchText)
But both above gave me error : 'Operator 'LIKE' not supported for type int' and 'Operator 'contains' not supported for type int'
Any ideas are greatly appreciated! Thank you in advance.