In the “Vegetable” class, why is the field “notes” an array of type Notes?
You may have several notes, so it is logical to get them in an array. What else did you think about ?
Again in the “Vegetable” class does the field “notes” get stored in the database, if so what is stored?
By default, all non-computed attributes are stored. Unless you use the @Transient macro.
In the “Note” Class it looks like the whole of the class “Vegetable” gets stored in the variable “vegetable”, which may or may not get stored in the database.
With @Relationship, SwiftData knows what needs to be saved to be able to rebuild the relations when needed. This tutorial should give you some insight.