title: Overriding a Failable Initializer for Swift
body: <p>Here is <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Initialization.html#//apple_ref/doc/uid/TP40014097-CH18-XID_306" rel="nofollow">a link</a> to a Swift tutorial.
  In section <strong>Initialization-Overriding a Failable Initializer</strong> 
  Note that if you override a failable superclass initializer with a nonfailable subclass initializer, the subclass initializer cannot delegate up to the superclass initializer.</p>
  
  <p>But the example below：</p>
  
  <pre><code>class Document {
      var name: String?
      // this initializer creates a document with a nil name value
      init() {}
      // this initializer creates a document with a non-empty name value
      init?(name: String) {
          if name.isEmpty { return nil }
          self.name = name
      }
  }
  </code></pre>
  
  <p>and：</p>
  
  <pre><code>class AutomaticallyNamedDocument: Document {
      override init() {
        super.init()
        self.name = "[Untitled]"
      }
      // This is nonfailable override superclass's failable 
      override init(name: String) {
        // Why subclass initializer still can delegate up to the superclass initializer？？
        super.init()
        if name.isEmpty {
          self.name = "[Untitled]"
        } else {
          self.name = name
        }
      }
  }
  </code></pre>
  
  <p><strong>Subclass initializer cannot delegate up to the superclass initializer</strong> 
  Why subclass initializer still can delegate up to the superclass initializer?</p>