diff --git a/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift b/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift index 2dad46b..baf1d18 100644 --- a/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift +++ b/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift @@ -120,13 +120,16 @@ public extension Dictionary { /// Return a float from a string created by looking up the specified key. This will return 0.0 if the key does not exist func floatForKey(_ key: String) -> Float { - return Float(stringForkey(key)) ?? 0.0 + guard let key = key as? Key else { return 0.0 } + + return self[key] as? Float ?? 0.0 } func optionalCGFloatForKey(_ key: String) -> CGFloat? { - guard let float = Float(stringForkey(key)) else { return nil } - return CGFloat(float) + guard let key = key as? Key else { return nil } + + return self[key] as? CGFloat } func floatFromStringForKey(_ key: String) -> Float { @@ -136,7 +139,9 @@ public extension Dictionary { func int32ForKey(_ key: String) -> Int32 { - return Int32(stringForkey(key)) ?? 0 + guard let key = key as? Key else { return 0 } + + return self[key] as? Int32 ?? 0 } private func objectChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> Any? {