title: Missing Argument for parameter ‘coder’ in call
body: <p>I have coded a custom UIButton as :</p>
  
  <pre><code> class AccountOpeningButton: UIButton {
    required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
          ......
     }
  }
  </code></pre>
  
  <p>I am able to instantiate this Class successfully using my Storyboard.
  Now, i made a UIView &amp; want to add this button in my UIView as :</p>
  
  <pre><code>var customView:UIView = UIView()
  customView.frame = CGRect(x: 0, y: 0, width: 350, height: 250)
  .....
  let fromDateBtn:UIButton = AccountOpeningButton()//Error comes here as  : Missing Argument for parameter ‘coder’ in call
  customView.addSubview(fromDateBtn)
  </code></pre>
  
  <p>So please help in in reusing this code dynamically also.</p>
  
  <p>P.S. : I referred <a href="http://napora.org/nscoder-and-swift-initialization/" rel="noreferrer">http://napora.org/nscoder-and-swift-initialization/</a>
  <a href="https://stackoverflow.com/questions/24036393/fatal-error-use-of-unimplemented-initializer-initcoder-for-class">Fatal error: use of unimplemented initializer &#39;init(coder:)&#39; for class</a>
  <a href="https://stackoverflow.com/questions/25126295/swift-class-does-not-implement-its-superclasss-required-members">Class does not implement its superclass&#39;s required members</a>
  But didn't succeed.</p>
  
  <p>=======================================================================
  <strong>TRIED</strong></p>
  
  <pre><code>let fromDateBtn:UIButton = UIButton() as! AccountOpeningButton
  </code></pre>
  
  <p>This throws CastException <em>Could not cast value of type 'UIButton' to '.AccountOpeningButton'</em></p>