title: 'Use of self in method call before super.init initializes self', can't init properties through a method call
body: <p>I'm curious is there is anyway to call a method inside your init method that sets instance properties of the class.  Essentially I just have a class that sub-classes UIView, adds some subviews in init, and some of those subviews are instance variables of the class.</p>
  
  <pre><code>class MyView: UIView {
      var collectionView: UICollectionView
  
      convenience init () {
          self.init(frame:CGRectZero)
      }
  
      override init (frame : CGRect) {
          super.init(frame : frame)
  
          addSubviews()
      }
  
      required init(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
  
          addSubviews()
      }
  
      func addSubviews (){
          self.collectionView = UICollectionView()
  
      }
  }
  </code></pre>
  
  <p>Now the problem comes that I can't call super init before initializing my classes internal properties (Property 'self.collectionView' not inialized at super.init call), but I also can't call my custom method to initialize those variables prior to super.init, as it cannot use self prior to that initialization.  I realize I could make the instance variable optional, but it seems less elegant, as I know it will always be initialized (and there are several more, this is just a simplified version).  Is there any way to accomplish this without making all my instance variables optionals?</p>
  
  <p>EDIT:</p>
  
  <p>I think ultimately my question is why does swift dis-allow calling a method prior to calling super.init?  What's the difference between:</p>
  
  <pre><code>override init (frame : CGRect) {
      addSubviews()
      super.init(frame : frame)
  }
  
  final func addSubviews (){
      self.collectionView = UICollectionView()
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>override init (frame : CGRect) {
      self.collectionView = UICollectionView()
      super.init(frame : frame)
  }
  </code></pre>