https://developer.apple.com/swift/blog/?id=25

The Core: _Nullable and _Nonnull

_Nullable is a pointer that may have a NULL or nil value
_NonNull should not. The compiler will tell you if you break the rules.

– (AAPLListItem * _Nullable)itemWithName:(NSString * _Nonnull)name; @property (copy, readonly) NSArray * _Nonnull allItems;

You can use _Nullable and _NonNull any where you need a pointer. A nicer way to write these within method declarations however is as follows:

_Nullable -> nullable
_Nonnull -> nonnull

– (nullable AAPLListItem *)itemWithName:(nonnull NSString *)name; – (NSInteger)indexOfItem:(nonnull AAPLListItem *)item;

or for properties

@property (copy, nullable) NSString *name; @property (copy, readonly, nonnull) NSArray *allItems;

Audited regions

You can mark certain regions in your code as audited for nullability. Within these regions any simple pointer type will be assumed to be nonnull.

NS_ASSUME_NONNULL_BEGIN
@interface AAPLList : NSObject <NSCoding, NSCopying>
// ...
- (nullable AAPLListItem *)itemWithName:(NSString *)name;
- (NSInteger)indexOfItem:(AAPLListItem *)item;
@property (copy, nullable) NSString *name;
@property (copy, readonly) NSArray *allItems;
// ... @end
NS_ASSUME_NONNULL_END