For the purpose of this question, let us say that I have a class that represents any given type of data. The objects of these classes can "connect" to one another in order to form a network.
class DataObject
{
var value: Any?
var connectedObjects = [DataObject]()
func connectToObject(object: DataObject)
{
connectedObjects.append(object)
}
}
From what I understand, Swift arrays retain objects. In the event of multiple, interlinked DataObject
instances, does retainership provide any scope for performance degradation / memory leaks? And what is this particular problem pattern known as?