Avatar
https://twitter.com/johannesweiss/status/1297937217789337600 @swift-5.2.5 class One { var x: Int? init?() { return nil } deinit { print("YO") } } class Two { var x: Optional<Int> init?() { return nil } deinit { print("NO") } } _ = One() _ = Two() (edited)
@NSExceptional @steipete It’s confusing to everybody! Int? gets magically nil initialised before init. So the class is fully initialised before init (and will therefore be deinit’ed). Optional<Int> does not get this magic nil init, so the variable is uninitialised so...