From e199cd9c02b6504e56740fa02dfa578df40d7869 Mon Sep 17 00:00:00 2001 From: "Christiano, Kevin" Date: Tue, 7 May 2019 16:05:46 -0400 Subject: [PATCH] go back. --- .../Categories/Dictionary+MFConvenience.swift | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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? {