What is nonnull in objective C?

后端 未结 4 472
一向
一向 2021-02-05 09:49

Can someone elaborate why is nonnull introduced in iOS 9 ?

For example, the NSArray method + (instancetype)array; is now + (

4条回答
  •  余生分开走
    2021-02-05 10:32

    nonnull is a keyword to tell the compiler that the return value (or parameter, or property) will never be nil. This was introduced in a previous version of Xcode to enable better inter operability between Obj-C and Swift's optional types.

    You can learn more about it on the official Swift blog

提交回复
热议问题