I\'m finding some surprising behavior with optional dictionaries in Swift.
var foo:Dictionary? if (foo == nil) { foo = [\"bar\": \
I tried this for Swift 3.1 and it worked:
if (myDict?[key] = value) == nil { myDict = [key: value] }