ios - 求助 '@property (nonnull)' 这是什么?

标签 ios objective-c iphone

@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/

相关文章:

ios - 在 Xcode UITest 中访问 app.buttons 而无需任何可用的文本供引用。

ios - NSURLRequest swift 出现 fatal error 异常

iphone - SIGABRT @ [self.window addSubview :viewController. View ];仅在设备上

ios - 保持 UITableView 填充在标题上,但在 IOS7 上没有分隔符

objective-c - 使用 Objective c 修改现有的 XML 文件

ios - iAd付款细节

iOS - 如何在后台完成长进程

ios - 有什么方法可以使用全局静态字典来访问 objective-c ios 中的所有 View Controller 吗?

ios - 在 UITableViewCell 的 UIButton 位置插入 UIView

iphone - AudioQueueGetProperty(queueObject, kAudioQueueProperty_IsRunning, &status, &statusSize) 为状态返回垃圾