@property (nonnull)
。是nonnull
iOS8.3中添加了它,它能做什么?
最佳答案
是的,XCode 6.3 中添加了
从 here (nshipster) 获取此信息
nonnull: Indicates that the pointer should/will never be nil. Pointers annotated with nonnull are imported into Swift as their non-optional base value (i.e., NSData).
还有其他两个类似的属性
- null_resettable
Indicates that while a property will always have a value, it can be reset by assigning nil. Properties with a non-nil default value can be annotated this way, like tintColor. Imported into Swift as a (relatively safe) implicitly unwrapped optional.
- 可为空
Indicates that the pointer can be nil in general practice. Imported into Swift as an optional value
- null_unspecified
Continues the current functionality of importing into Swift as an implicitly unwrapped optional, ideally to be used during this annotation process only.
您可以查看What do the null-related property attributes in XCode do?
关于ios - 求助 '@property (nonnull)' 这是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29555220/