Search code examples
swiftnsdictionarywatchkitwatchos-2

Binary operator "&&" cannot be applied to two String operands


I'm getting this error...

Binary operator "&&" cannot be applied to two String operands

for this line of code...

try WatchSessionManager.sharedManager.updateApplicationContext
(["color" : newPlay.tColor] && ["match" : newPlay.match])

I'm trying to updateApplicationContext with both "color" and "match".

I can't do them separately, or else it only takes the second line of code. i.e This would only pass match but not color:

try WatchSessionManager.sharedManager.updateApplicationContext(["color" : newPlay.tColor])
try WatchSessionManager.sharedManager.updateApplicationContext(["match" : newPlay.match])

Thanks for the help!


Solution

  • Answer is:

    try WatchSessionManager.sharedManager.updateApplicationContext(["color" : newPlay.tColor, "match" : newPlay.match])