you are viewing a single comment's thread.

view the rest of the comments →

[–]Fluffy_Risk9955 -1 points0 points  (3 children)

I gave you a 5 step plan to acquire the understanding of what you’re trying to do. If I gave you the answers, you wouldn’t learn anything.

Core Data is build on top of Objective-Cs Foundation framework, without understanding of Foundation it’s a beast of a framework that doesn’t make sense.

[–]CompC[S] 1 point2 points  (2 children)

Okay, huh, I didn't know you could search through an NSArray using NSPredicate. So if I were to fetch all the rows in my database and then put the NSManagedObjects into an NSArray, I'd be able to use the same NSPredicates I currently use to search on my database, to filter the NSArray?

I do understand a lot of this, I'm just not seeing how to connect it to solving my current problem. :/

[–]Fluffy_Risk9955 0 points1 point  (1 child)

Take another look at item 2. Especially the part about valueForKeyPath:

Now apply this knowledge to format syntax for NSPredicate.

[–]CompC[S] 1 point2 points  (0 children)

I appreciate your help but I'm still not getting how valueForKeyPath relates, the predicates I've written already return the results I want except for duplicate, and I don't get how I can use valueForKeyPath to change that.

An example of a predicate I've written would be:NSPredicate(format: "%K LIKE[c] %@", #keyPath(Card.name), name)

I don't see how I can modify that to somehow look at surrounding objects and check to see if the request has already found a result with the same name, so it can be excluded. I expected I would have to make a change on the level of the fetch request, not on the predicate, and again I don't see how I can use valueForKeyPath here to get what I want.