returning non nil potentially void dictionary

This commit is contained in:
Jean-Michel Douliez 2016-04-26 19:28:05 +02:00 committed by douliez
parent 09a0222308
commit 4b39e0579f

View File

@ -18,4 +18,20 @@ class APIHelper {
}
return destination
}
static func convertBoolToString(source: [String: AnyObject]) -> [String:AnyObject] {
var destination = [String:AnyObject]()
let theTrue = NSNumber(bool: true)
let theFalse = NSNumber(bool: false)
for (key, value) in source {
switch value {
case let x where x === theTrue || x === theFalse:
destination[key] = "\(value as! Bool)"
default:
destination[key] = value
}
}
return destination
}
}