predicate with avoid child entity iOS swift
Problem: I had my coredata entity that main entity had one level of subentity with the same entity.But in predicate i want to avoid the subentity entry but if subentity has the predicated text then main entity wants to be came.How can i achieve that? Solution: First you have to add issubentity in the coredata entity and enter if subentity then true otherwise it will be false.Then follow the below code. predicateStringAdd. append ( NSPr edicate ( format : "(time.startsOn >= %@ OR ANY subEntity.time.startsOn >= %@) AND isSubEntity != true" ,time1,time2)) the above will be based on start above start time and below endtime. You can check with string as like below predicateString. append ( NSPredi cate ( format : "( name CONTAINS[c] %@ OR ANY subEntity.name CONTAINS[c] %@ OR desc CONTAINS[c] ...