I have a Core Data entity which has an attribute called likedMovies
which is a String array [String]
. This is configured as a Transformable attribute.
I populate a list of IDs inside this attribute, so for example:
User entity:name = Duncan | likedMovies = [524, 558, 721]
name = Saskia | likedMovies = [143, 558, 653]
name = Marek | likedMovies = [655, 323, 112]
I would like to write a predicate which returns all User
entities where the likedMovies
array contains a given value. I have tried the predicate below but it doesn't work - for the id 558, instead of returning [Duncan, Saskia]
I get no entities returned.
fetchRequest.predicate = NSPredicate(format: "%@ IN %@", "558", "likedMovies")
Thank you in advance for your help.