// *** before: ***
// almost every pointer in a header is non-empty, so annotating each one by
// hand filled the file with noise - and the compiler demanded all or none:
// annotating a single method warned about every other one in the same header
@interface Library : NSObject
- (nonnull instancetype)initWithName:(nonnull NSString *)name;
- (void)addBook:(nonnull Book *)book;
- (nonnull NSArray *)allBooks;
- (nullable Book *)bookWithTitle:(nonnull NSString *)title;
@property (nonatomic, copy, nonnull) NSString *name;
@property (nonatomic, strong, nullable) Book *current;
@end
// *** in version 2015: ***
// inside the region every plain pointer counts as nonnull, and only the
// exceptions are marked
NS_ASSUME_NONNULL_BEGIN
@interface Library : NSObject
- (instancetype)initWithName:(NSString *)name;
- (void)addBook:(Book *)book;
- (NSArray *)allBooks;
- (nullable Book *)bookWithTitle:(NSString *)title; // the exception
@property (nonatomic, copy) NSString *name;
@property (nonatomic, strong, nullable) Book *current;
@end
NS_ASSUME_NONNULL_END
// the region does not cover everything: a plain C pointer, a typedef and
// the type inside a generic parameter still need _Nullable or _Nonnull
// written out by hand