I am trying to cast a (Any)? value to a Integer. I am retrieving information from Firebase and I want to add the number by something else. That is why the (Any)? value needs to be a Integer. I have this:
let snapshotValues = snapshot.value as? NSDictionary
let gamesWon = snapshotValues!.value(forKey: "GamesWon")
let gamesLost = snapshotValues!.value(forKey: "GamesLost")
let totalgamesPlayedByUser = gamesWon + gamesLost
This is giving me an error that two Any? objects can not be added together. I already tried the Int(gamesWon), gamesWon as! Int, but that did not work. How to cast this as a Integer?