tadija/AEXML — pull request #6 by ghowen (2014-11-23 18:40:56+00:00)
Title: Made parent in AEXMLElement weak to fix memory leak

(Temporary?) fix for the memory leak in AEXMLElement

I am struggeling myself with the best way to go about it... In most of the tutorials the reference to a parent in a child is advised to be unowned. See i.e. http://guides.codepath.com/ios/Swift-Intermediate states: "However, only use unowned references when you're sure the parent will exist for the lifetime of the child." And this is exactly the case in an XML like structure. AFAIK making the parent weak means that the child still has to function even if at some point in time the parent does not live anymore. Code like

parent?.children.filter

would then fail, because parent would be nil. Or am I mistaken here? I'm just a few weeks into Swift and still learning...

Best regards, Georg