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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -