title: Subclassing Objective-C Classes in Swift
body: <p>I am using <a href="https://github.com/mwaterfall/MWPhotoBrowser" rel="nofollow">MWPhotoBrowser</a> in a Swift project. One problem is that a subclass of MWPhotoBrowser will fail to compile with such error:</p>
  
  <blockquote>
    <p>:0: error: cannot override 'init' which has been marked unavailable</p>
  </blockquote>
  
  <p>My code here:</p>
  
  <pre><code>class BrowseController: MWPhotoBrowser {
  override init() {
      super.init()
      initialize()
  }
  
  required init(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
      initialize()
  }
  
  override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
      super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
      initialize()
  }
  ...
  </code></pre>
  
  <p>And here are all the initializers of the parent class:</p>
  
  <pre><code>// Init
  - (id)initWithPhotos:(NSArray *)photosArray  __attribute__((deprecated("Use initWithDelegate: instead"))); // Depreciated
  - (id)initWithDelegate:(id &lt;MWPhotoBrowserDelegate&gt;)delegate;
  </code></pre>
  
  <p>Overriding these initializers in my subclass does not help. But if I create a subclass MyBrowser in Objective-C and then subclass from this class, everything works fine.</p>
  
  <pre><code>@interface MyBrowser : MWPhotoBrowser
  - (id)init;
  @end
  
  @implementation MyBrowser
  - (id)init {
      if (self = [super init]) {}
      return self;
  }
  @end
  
  class BrowserController: MyBrowser {
  ...
  </code></pre>
  
  <p>I'm using Xcode 6.1. Is this a Swift bug or did I miss something about Swift intializers? Thanks!</p>