I have seen in the apple document they have mentioned that =
, ==
will behave same.
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795-SW1
But in apple examples they use ==
in most cases and =
for nil check.
Is it safe to use =
for the below case?
NSPredicate(format: "firstName = %@", "Bunny")
or should we use:
NSPredicate(format: "firstName == %@", "Bunny")
Is there any difference between the two when dealing with predicates?
They are equivalent when used in NSPredicate. I suppose there might be a slight preference for ==
since it would "look" more correct when combined with other Swift code. But either would be safe to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With