title: Making a custom UIView subview that fills its superview
body: <p>So I wrote my own custom view with its own initializer. However, when my main view loads my custom view gets depicted in a wrong way. It takes bounds as 600x600 rectangle, while the superview is 375x607. I did try to put auto constraint, seems not to work. I tried to do it programmatically in the subview initialization, but whenever I try to initialize it's bounds property to its superview bounds I get nil in superview.</p>
  
  <pre><code>override init(frame: CGRect) {
      super.init(frame: frame)
      self.setup()
  }
  
  required init(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
      self.setup()
  }
  
  func setup() {
      initPathLayer()
      initHandleView()
      initHandlePanGestureRecognizer()
  
      layoutPathLayer()
      layoutHandleViews()
  }
  </code></pre>
  
  <p>I tried everything there is on the internet to make subview fill its superview, but I think that subview gets initialized before superview? Is that possible ? In the ViewController a have my custom view declared as an Outlet connection. I'm sure that the problem should be super easy and it's me who doesn't know the way Swift initializes the view.</p>
  
  <p>Any ideas ?</p>
  
  <p>Thank You.</p>