I have three core data entity types which are subclasses of a shared parent class, but which do not inherit from a shared parent entity type in Core Data. Let's call the three types businesses, customers, and products. Every entity type has the possibility of many-to-many relationships with each of the other entity types. e.g., a business could have relationships with multiple other businesses, customers, and products. A product could be sold by multiple businesses and have been purchased by multiple customers, and be related to other products. These are Core Data many-to-many relationships.
There are two contexts in which I am presenting these entities: as results from a search, and to display the other entities that are in relationship with a specific entity that the user has selected. Currently, I have implemented both of these contexts as being entity-type specific—at any one time you search for products, or businesses, or customers. You change to a different scope within a UISearchBar to swap between entity types. Likewise, when viewing details of a specific entity, you can view lists of the items related to that entity separately for each of the three types. Results are fetched with an NSFetchResultsController in both cases, with an appropriate predicate. Some users have 10,000 entities in total across the categories. Few or none will have 100,000.
I want to present collections that instead intermix items from all three of these types in the displayed results or lists.
As far as I am aware, this is not possible with an NSFetchedResultsController unless I redesigned my Core Data model to have them all inherit from a base entity type, and that seems to have significant downsides on an ongoing basis, in addition to the necessary complex migration.
What is the best way to achieve this? I am open to any technology, any approach, and am willing to raise the required iOS version to iOS 13 or even iOS 14 in order to be able to use the most ideal approach.
There are two contexts in which I am presenting these entities: as results from a search, and to display the other entities that are in relationship with a specific entity that the user has selected. Currently, I have implemented both of these contexts as being entity-type specific—at any one time you search for products, or businesses, or customers. You change to a different scope within a UISearchBar to swap between entity types. Likewise, when viewing details of a specific entity, you can view lists of the items related to that entity separately for each of the three types. Results are fetched with an NSFetchResultsController in both cases, with an appropriate predicate. Some users have 10,000 entities in total across the categories. Few or none will have 100,000.
I want to present collections that instead intermix items from all three of these types in the displayed results or lists.
As far as I am aware, this is not possible with an NSFetchedResultsController unless I redesigned my Core Data model to have them all inherit from a base entity type, and that seems to have significant downsides on an ongoing basis, in addition to the necessary complex migration.
What is the best way to achieve this? I am open to any technology, any approach, and am willing to raise the required iOS version to iOS 13 or even iOS 14 in order to be able to use the most ideal approach.