I would like to create an object array as a property of another class in Swift, such as:
class person{
 var livingInHouse : house
 name : String
}
class house{
 var personArray : [person]
}
My constraints are:
- I would like to easily access the objects in the personArray using subscripts: e.g. houseInstance.personArray[1].name = "Steve"
- I would like to create the personArrayso that thepersonobjects are deallocated whenhouseInstanceobject is deallocated. What is the best method in Swift to do this?
 
     
    