title: Swift extend UIView to return calling type
body: <p>I want to extend base class (UIView) where I work on that object and return the calling object with correct type</p>
  <pre class="lang-swift prettyprint-override"><code>extension UIView {
      func withCleanBg() -&gt; UIView {
          self.backgroundColor = .clear
          return self;
      }
  }
  </code></pre>
  <p>For example if I call <code>let btn:UIButton = UIButton().withCleanBg()</code> I want the <code>btn</code> to stay UIButton after calling the extension and not to get UpCasted.</p>
  <p>I want this to chain function calls like
  <code>UIButton().withCleanBg().withFillInParent()</code> and so on</p>