【发布时间】:2017-10-09 20:57:09
【问题描述】:
我在苹果文档中看到他们提到=、== 的行为相同。
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-SW1
但在苹果示例中,他们在大多数情况下使用==,并使用= 进行零检查。
在以下情况下使用= 是否安全?
NSPredicate(format: "firstName = %@", "Bunny")
或者我们应该使用:
NSPredicate(format: "firstName == %@", "Bunny")
两者在处理谓词时有什么区别吗?
【问题讨论】: