Page 163

Swift Subclass initializer cannot delegate up to the superclass initializer when overriding a failable superclass initializer with a non-failable subclass initialize. A non-failable initializer can never delegate to a failable initializer. The program given below describes the failable and non-failable initializers. class Planet { var name: String

init(name: String) { = name }

convenience init() { self.init(name: "[No Planets]") } } let plName = Planet(name: "Mercury") println("Planet name is: \(")

let noplName = Planet() println("No Planets like that: \(")

class planets: Planet { var count: Int

init(name: String, count: Int) { self.count = count super.init(name: name) }

override convenience init(name: String) { self.init(name: name, count: 1) } } When we run the above program using playground, we get the following result: 151

​Quick is just a powerful and spontaneous programming language for macOS, iOS, watchOS and tvO...