Extend to cope with double + float
This commit is contained in:
parent
8e6777dc4e
commit
fea3e9c026
|
@ -43,6 +43,12 @@ extension StORM {
|
|||
// Double
|
||||
// =======================================================================================
|
||||
public static func double(_ data: [String: Any], _ name: String, _ def: Double? = Double()) -> Double? {
|
||||
if let d = data[name] as? Float {
|
||||
return Double(d)
|
||||
|
||||
} else if let d = data[name] as? Double {
|
||||
return d
|
||||
}
|
||||
return Double((data[name] as? Float) ?? Float(def ?? 0.00))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue