Swift mutable dictionary being treated as immutable
问题 I am trying to implement In App Purchases, and I am tracking which purchases a user has purchased via NSUserDefaults . I have a function that sets the values of each purchase, but when it runs, I get an error saying that I am mutating the dictionary of purchase values even though the dictionary is declared with a var instead of a let and is an NSMutableDictionary . Sometimes it does work, but most of the time it doesn't. I get a few warnings about declaring my variables with let instead of