Can we ensure nullability of `+ (nonnull instancetype)sharedInstance;`?
This is a question on how to gracefully circumvent the nullability of init in NSObject class. So here is a classic objective-c implementation: + (instancetype)sharedInstance { static dispatch_once_t onceToken; static id sharedInstance; dispatch_once(&onceToken, ^ { sharedInstance = [[self alloc] init]; }); return sharedInstance; } But now I want to declare it as nonnull , if possible: + (nonnull instancetype)sharedInstance; Unfortunately, init returns a nullable instancetype value. Should I add an NSAssert or something after calling init ? I noticed that some people even document nonnull