0
votes

I have a question regarding the construction of an NSPredicate to fetch entities from a Core-Data store backed by SQLite:

One of my entities has a string typed attribute called "uti". Is it possible to construct a predicate that matches wether or not "uti" conforms to another UTI?

After looking at the documentation I've tried:

NSPredicate(format: "uti UTI-CONFORMS-TO %@", aUti)

but this does not seem to be supported.

Thanks in advance!

1

1 Answers

0
votes

You are correct, this is not supported.

One solution is to keep track of supported UTIs yourself. You could download a relevant portion of the UTI catalogue (i.e., whatever you need for your app, such as public.image) and keep track of them by adding a to-many relationship to your entity pointing at all the supported UTIs. These could be represented by an entity with only one simple string attribute. You could override the setter for the uti property to do this automatically.