I am using a list of params of type Dictionary
in a Swift iOS application to hold some parameters that will eventually be passed to a we
true
really is 1, so it's not inaccurate; it really is storing the Bool, but since it's coming out the other end as AnyObject
, it's just printing it out as an integer since it doesn't know the exact type.
You can try to cast it to test for a Bool:
var params = Dictionary()
params["tester"] = true
if let boolValue = params["tester"] as? Bool {
println("\(boolValue)")
}
That's the safe way to do it.