NSPredicate中的= vs ==

Ans*_*shu 3 cocoa core-data ios

我在苹果文件中看到他们提到过===将表现相同。 https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-SW1

但是在苹果的例子中,它们==在大多数情况下都=用于零检查。

=在以下情况下使用安全吗?

NSPredicate(format: "firstName = %@", "Bunny")
Run Code Online (Sandbox Code Playgroud)

还是应该使用:

NSPredicate(format: "firstName == %@", "Bunny")
Run Code Online (Sandbox Code Playgroud)

在处理谓词时,两者之间有什么区别吗?

pic*_*ano 6

它们在NSPredicate中使用时是等效的。我想可能会有一点偏爱,==因为当与其他Swift代码结合使用时,它会“看起来”更正确。但是任何一种都可以安全使用。