5 ms·
Not exactly. ObjC code cannot usefully benefit from those annotations (yet? more likely ever). At most, it's good for documenting your ObjC code for fellow read
by oleganza 12y ago
Not exactly. ObjC code cannot usefully benefit from those annotations (yet? more likely ever). At most, it's good for documenting your ObjC code for fellow readers. The actual use appears in the Swiftland where instead of implicitly unwrapped optionals you get proper explicit optionals or explicit non-optionals.
- ejdyksen 12y agoThe benefit to working with the Cocoa APIs will be immense, though. I assume that, now that this feature exists, Apple will begin annotating their Obj-C APIs.
- oleganza 12y agoThey already started doing it a few months ago with private annotations. This "nonnull"/"nullable" syntax is a result of their work on annotating Cocoa APIs.
- eridius 12y agoThey've been doing it for a while in the Swift overlay module. I'm really happy that this is officially added to obj-c because it provides very valuable API documentation, even if it won't have much practical effect on the code.
- austinz 12y agoIt looks like the annotations will allow the compiler to produce warnings when compiling the Objective-C code, so that's something: "However, nullability annotations—in addition to improving the experience in Swift—provide new warnings in Objective-C"