<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
Yes, but why?<div><br /><div>What's the rationale for this?</div><div><br /></div><div>What would be so bad about allowing overriding a non-failable initializer with a failable initializer?</div><div><br />27. Jan 2017 18:59 by <a href="mailto:saagar@saagarjha.com" target="_blank" rel="noopener noreferrer">saagar@saagarjha.com</a>:<br /><br /><blockquote class="tutanota_quote" style="border-left: 1px solid #93A3B8; padding-left: 10px; margin-left: 5px;">You can’t override a designated initializer with one that is failable. The second one is defining a new initializer that is failable, instead of overriding the one from its superclass.<div><br /><div>
<div style="color: rgb( 0 , 0 , 0 ) ; letter-spacing: normal ; text-indent: 0px ; text-transform: none ; white-space: normal ; word-spacing: 0px ; word-wrap: break-word">Saagar Jha</div>
</div>
<br /><div><blockquote class="thunderbird_quote" style="border-left: 1px solid #93a3b8 ; padding-left: 10px ; margin-left: 5px"><div>On Jan 27, 2017, at 8:45 AM, tuuranton--- via swift-users <<a href="mailto:swift-users@swift.org" target="_blank" rel="noopener noreferrer">swift-users@swift.org</a>> wrote:</div><br class="Apple-interchange-newline" /><div>
<div>
<div>See the comments. Why is one allowed but the other one isn't and what's the rationale for this?</div><div><br /></div><div><br /></div><div>class Vehicle {</div><div> let name: String</div><div> init(name: String) {</div><div> self.name = name</div><div> }</div><div>}</div><div><br /></div><div><br /></div><div>class Car: Vehicle {</div><div> //Why is this not allowed?</div><div> override init?(name: String) {</div><div> super.init(name: name)</div><div> }</div><div> </div><div> //But this is allowed?</div><div> init?(name: String, ignore: String) {</div><div> super.init(name: name)</div><div> }</div><div>}</div><div><br /></div><div><br /></div><div><br /></div> </div>
_______________________________________________<br />swift-users mailing list<br /><a href="mailto:swift-users@swift.org" target="_blank" rel="noopener noreferrer">swift-users@swift.org</a><br /><a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank" rel="noopener noreferrer">https://lists.swift.org/mailman/listinfo/swift-users</a><br /></div></blockquote></div><br /></div></blockquote></div></div> </body>
</html>