title: Getting the View's center when initialing a variable
body: <p>I'm very new to Swift and trying to make a simple application to learn.
  I'm trying to setup on screen a UISlider and set it in the middle of the screen, the problem is that the view is probably isn't ready yet.
  I tried to do something like this:</p>
  
  <pre><code>&gt; private let bullsEyeSlider: UISlider = {
  &gt;         let slider = UISlider(frame: CGRect(x: self.view.frame.midX,y:100, width: 500, height: 20))
  &gt;         slider.minimumValue = 0
  &gt;         slider.maximumValue = 100
  &gt;         return slider
  &gt;     }()
  </code></pre>
  
  <p>to get the center of the view (the x center at least) but of course it can't work.
  I'm trying to think of something else to do but other than just setting up the slider after the view is initialised I can't think of anything else.
  Tried to search the web but with no luck.</p>