Tejas Tejas - 26 days ago 5x
iOS Question

How to perform conditional 'executeFetchRequest' to fetch only those entities where particular attribute is nil?

I want to execute a fetch request where I should get only those entities in result whose particular attributes have a nil value. (say attribute: firstName). So How will I write it in following format ? Everything I have in place, just want to know how to add predicate for nil value condition. This predicate gives me error:
fetchRequest.predicate = NSPredicate(format: "firstName == %@", nil)


Here you are:

fetchRequest.predicate = NSPredicate(format: "firstName == NIL")