Downcasting optionals in Swift: as? Type, or as! Type?

The practical difference is this: var optionalString = dict[“SomeKey”] as? String optionalString will be a variable of type String?. If the underlying type is something other than a String this will harmlessly just assign nil to the optional. var optionalString = dict[“SomeKey”] as! String? This says, I know this thing is a String?. This too … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)