[swift-evolution] Remove Failable Initializers

Tino Heth 2th at gmx.de
Wed Mar 9 04:32:15 CST 2016


As ease of use and performance implications have been discussed, I would still like to see the question of consistency addressed:
In Objective-C, returning nil from an initializer is nothing special — it is a regular function that returns id (self in most cases).

Swift, on the other hand, is different:
Init-methods are void-functions in every aspect, with the irregularity that we can return "nil" (if the initializer is marked accordingly).

Am I the only one who has the feeling that this is a little bit odd?
What kind of method is a initializer in Swift?

Tino



More information about the swift-evolution mailing list