I am searching a key in an Array
of Dictionarys
and I want to convert the result value into an Int
value. This is what I tried.
Here i have given example to convert Anyobject to Int and String
var idInt : Int = 0
if let ids: AnyObject = responseDict["id"] {
if let idsInt = ids as? Int{
idInt = idsInt
print(idInt)
}
}
var nameString : String = ""
if let name: AnyObject = responseDict["name"] {
if let nameStr = name as? String{
nameString = nameStr
print(nameString)
}
}