title: Creating an NSMutabaleArray subclass in Swift
body: <p>I'm trying to create an <code>NSMutableArray</code> subclass, in Swift, which supports an array literal initializer.</p>
  
  <p>I can create a simple subclass:</p>
  
  <pre><code>class MyArray: NSMutableArray {
  }
  </code></pre>
  
  <p>And initialisation works fine:</p>
  
  <pre><code>let arrayInstance: MyArray = MyArray()
  </code></pre>
  
  <p>However, if I try to use an array literal:</p>
  
  <pre><code>let arrayInstance: MyArray = ["one"]
  </code></pre>
  
  <p>It fails at runtime, <code>[NSMutableArray initWithCapacity:]: method only defined for abstract class.</code>.</p>
  
  <p>I can add this initialiser, however, as a result I also have to add the other required initialisers:</p>
  
  <pre><code>class MyArray: NSMutableArray {
    override init(capacity numItems: Int) {
      super.init(capacity: numItems)
    }
  
    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
  
    required convenience init(arrayLiteral elements: AnyObject...) {
        fatalError("init(arrayLiteral:) has not been implemented")
    }
  }
  </code></pre>
  
  <p>Unfortunately the second required initialiser yields the following compiler error:</p>
  
  <blockquote>
    <p>Declarations from extensions cannot be overridden yet</p>
  </blockquote>
  
  <p>It looks like I am stuck! Can anyone suggest a way to create an <code>NSMutableArray</code> subclass that supports array literals? Otherwise it's back to Objective-C for me!</p>