CoreData array as attribute vs relationship

I recently started to learn CoreData with CloudKit in SwiftUI. It seems to be still quite a young solution (I know CoreData itself has been around for over a decade), so apart from some limited resources within the official documentation and archive, I get most information from the web.

One thing that I had trouble with was storing in CoreData moderately complex data received in JSON format. Although I read that CoreData itself is not a relational database, it does look much alike to me, so my first choice would be to use relationships, but I saw people store arrays of data using attributes instead, e.g., in this StackOverflow thread. In my case, it would be an array of custom datatype objects, and while some resources on the web were helpful to get me quite far (e.g. this), I couldn't pull it off in the end.

My question after this long background story is — in what situations would I choose attributes for storing collections of data instead of relationships?

As an example, I currently have an entity Food in a to-many relationship with an entity Portion (a cup of rice, 8 oz of rice, etc.)

CoreData array as attribute vs relationship
 
 
Q