swift - Binary operator '===' cannot be applied to two 'String' operands -


why can't === used string's in swift? unable compile following:

let string1 = "bob" let string2 = "fred"  if string1 === string2 {     ... } 

and following error (on if line):

binary operator '===' cannot applied 2 'string' operands


what want able in unit tests is, having performed copywithzone:, verify 2 objects indeed different object different pointers if values same. following code doesn't work...

xctassertfalse(object1.somestring === object2.somestring)

if knows of alternative way please advise.

string1 , string2 not nsstring, string. since value objects, not reference objects, there no reference compared ===.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -