title: init let properties with reference to self in subclass in swift
body: <p>I'm learning swift and coming across the following problem very often. I will have a class with a property that feels as if it should be a <code>let</code> property as it will only be set once. I'd also like this child object to maintain a reference to its owner, which should also be a <code>let</code> property, as the parent relationship will not change. The problem arises when the parent class subclasses another class and all <code>let</code> properties need to be set before <code>super.init ()</code> is run but requires a reference to <code>self</code> to init.</p>
  
  <p>Here's a quick example</p>
  
  <pre><code>class NodeView: UIView {
      let _nodePlugView: NodePlugView
  
      init (node: Node) {
          _nodePlugView = NodePlugView (parentView: self)
          super.init ()
      }
  }
  </code></pre>
  
  <p>Of course, I could just use <code>var</code> for these <code>_nodePlugView</code> but it doesn't feel quite right. Is there another pattern that people would recommend?</p>