Filter CoreData list at some Index for a freemium app

Hello,

I'm building a freemium app with CoreData. One of the subscription features is to unlock "creating unlimited items". So if the user don't subscribe have a limit of i.e 10 items.

I have restricted the item creation when the limit is 10 items, but when a user becomes subscriber and then cancel subscription I need to "lock" the previously created items (until 10) and leave only for delete (if the user wants). I will use a lock image over the item.

I'm looking for the best way to do this. I have the FetchRequest, then filter with some parameters like "search text" or type and then show in a View.

How can be a good solution of it? I'm thinking in ".firstIndex(of: )", but don't seems the optimum solution because it will called everytime the view is generated...

Any ideas?

Thanks!!

Filter CoreData list at some Index for a freemium app
 
 
Q