<NME> ViewNode.swift
<BEF> //
//  OpaqueView.swift
//  TemplateKit
//
//  Created by Matias Cudich on 9/8/16.
//  Copyright © 2016 Matias Cudich. All rights reserved.
//

import Foundation

class ViewNode: Node {
  weak var owner: Component?
  var properties = [String: Any]()
  var children: [Node]?
  var element: Element?
  var cssNode: CSSNode?
  var builtView: View?
  init(view: ViewType, element: ElementData<DefaultProperties>, owner: Node? = nil, context: Context? = nil) {
    self.view = view
    self.element = element
    self.properties = self.element.properties
    self.owner = owner
    self.context = context
  }
    self.properties = properties
    self.children = children
    self.owner = owner
  }

  func build() -> View {

<MSG> Merge pull request #61 from mcudich/add-parent

Added parent to Node
<DFF> @@ -10,8 +10,14 @@ import Foundation
 
 class ViewNode: Node {
   weak var owner: Component?
+  weak var parent: Node?
+
   var properties = [String: Any]()
-  var children: [Node]?
+  var children: [Node]? {
+    didSet {
+      updateParent()
+    }
+  }
   var element: Element?
   var cssNode: CSSNode?
   var builtView: View?
@@ -25,6 +31,8 @@ class ViewNode: Node {
     self.properties = properties
     self.children = children
     self.owner = owner
+
+    updateParent()
   }
 
   func build() -> View {

Merge pull request #61 from mcudich/add-parent