correction.

This commit is contained in:
Christiano, Kevin 2019-05-07 14:08:24 -04:00
parent a6ee9ca775
commit a63997fa09

View File

@ -66,7 +66,9 @@ public extension Dictionary {
/// Returns a String after looking up the specified key. Nil will be returned if a string for the key does not exist
func optionalStringForKey(_ key: String) -> String? {
return objectChainOfKeysOrIndexes([key]) as? String
guard let key = key as? Key else { return nil }
return self[key] as? String
}
/// Returns an Array after looking up the specified key. An empty array will be returned if an array for the key does not exist
@ -118,7 +120,9 @@ 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 objectChainOfKeysOrIndexes([key]) as? Float ?? 0.0
guard let key = key as? Key else { return 0.0 }
return self[key] as? Float ?? 0.0
}
func optionalCGFloatForKey(_ key: String) -> CGFloat? {