calebmanley
calebmanley

Reputation: 431

Swift CoreData Model Help? (Example given)

I am creating an app that has a table of "collections" of sounds called mixes. Each sound in the mix has individual sound volumes associated with them.

I am struggling figuring out a data model that would work for me, keeping in mind that extra sound packs containing extra sounds can be downloaded.

Here is a picture I drew containing the basic idea. enter image description here

I started with a coredata entity for the mixes, containing an array of strings of sound locations. This worked great until I tried to implement individual volumes. I then thought a coredata entity for each sound would work, but seeing as more sounds can be downloaded, it doesnt seem fitting for coredata? I need a little guidance on how I could achieve this and for it to be future-proof for my sound pack downloading and other expansions.

Upvotes: 0

Views: 73

Answers (1)

user5890979
user5890979

Reputation:

I suggest you do it like this to simplify your setup. enter image description here

Edit: (I have edited the entire answer/configuration after thinking through your setup)

Actually, you can even delete the "Mixes" entity, and just go with "Mixtheme", and fetch all "mixthemes" and manually creating a list of "mixes" for the user interface, to avoid the "mixes" entity. As you wish :)

This way, you can:

Fetch all mixthemes with options: (name/locked/unlocked/other properties you choose to add)

Fetch all mixethemes connected sounds with their properties .

You actually only need these 2 entities.

Upvotes: 1

Related Questions