diff --git a/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift b/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift index baf1d18..2dad46b 100644 --- a/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift +++ b/MVMCore/MVMCore/Categories/Dictionary+MFConvenience.swift @@ -120,16 +120,13 @@ 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 { - guard let key = key as? Key else { return 0.0 } - - return self[key] as? Float ?? 0.0 + return Float(stringForkey(key)) ?? 0.0 } func optionalCGFloatForKey(_ key: String) -> CGFloat? { - guard let key = key as? Key else { return nil } - - return self[key] as? CGFloat + guard let float = Float(stringForkey(key)) else { return nil } + return CGFloat(float) } func floatFromStringForKey(_ key: String) -> Float { @@ -139,9 +136,7 @@ public extension Dictionary { func int32ForKey(_ key: String) -> Int32 { - guard let key = key as? Key else { return 0 } - - return self[key] as? Int32 ?? 0 + return Int32(stringForkey(key)) ?? 0 } private func objectChainOfKeysOrIndexes(_ keysOrIndexes: [Any]) -> Any? {