寻求帮助'@property(nonnull)'是什么? [英] For help '@property (nonnull)' what it is?
问题描述
@property(非null)
.iOS8.3中是否添加了 nonnull
,它能做什么?
@property (nonnull)
. Does nonnull
added in iOS8.3 and what can it do?
推荐答案
是的,它已在XCode 6.3中添加
Yes , it is added in XCode 6.3
nonnull:指示指针应该/永远不会为nil.用nonnull注释的指针作为其指针导入到Swift中非可选的基础值(即NSData).
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).
还有其他两个相似的属性
There are also other two similar properties
- null_resettable
表示虽然属性将始终具有值,但它可以是通过分配nil重置.具有非零默认值的属性可以是这样注释,就像tintColor一样.导入到Swift作为一个(相对安全)隐式展开的可选内容.
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.
- 可空
- null_unspecified
表示一般情况下指针可以为nil.进口的进入Swift作为可选值
Indicates that the pointer can be nil in general practice. Imported into Swift as an optional value
继续当前作为隐式解包的可选,理想情况下在此过程中使用仅限注释过程.
Continues the current functionality of importing into Swift as an implicitly unwrapped optional, ideally to be used during this annotation process only.
这篇关于寻求帮助'@property(nonnull)'是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!