Corrected some issues.

This commit is contained in:
Christiano, Kevin 2019-05-07 15:55:48 -04:00
parent a63997fa09
commit 633cda9f9f

View File

@ -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? {