Current bridging from Objective-C to Swift has this behaviour:
If we define a property in Objective-C, and we don’t say it is nullable or
nonnull, like this: @property (nonatomic, strong, readonly) NSString
When we reference it from Swift, this property will be bridging to* String!*
(*implicitly unwrapped optional*) type automatically, and *there is no
warning indicate we should check if this is nil first.*
So the result is when some edge cases happen, the App will crash.
As more and more large projects are trying to use Swift now, this may seems
a problem for more people.
The documents I can find is: https://developer.apple.com/swift/blog/?id=25
says “Swift cannot distinguish between optional and nonoptional references,
and imports it as an implicitly unwrapped optional.”
As in Objective-C, the default property is nullable(if you don’t say it is
nonnull), I am curious what’s the reason that the property is not bridging
to optional, for me, feel optional value should be a better fit here.
Anyone know what’s the consideration at Swift 2 when this change happens?