😑 using search-a-licious API now...
This commit is contained in:
@@ -9,7 +9,7 @@ extension KeyedDecodingContainer {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func decodeStringOrInt(forKey key: Key) throws -> Int? {
|
||||
public func decodeIntOrString(forKey key: Key) throws -> Int? {
|
||||
if let intVal = try? decode(Int.self, forKey: key) {
|
||||
return intVal
|
||||
}
|
||||
@@ -19,4 +19,14 @@ extension KeyedDecodingContainer {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func decodeStringOrArray(forKey key: Key) throws -> String? {
|
||||
if let arrayVal = try? decode([String].self, forKey: key) {
|
||||
return arrayVal.joined(separator: ",")
|
||||
}
|
||||
if let stringVal = try? decode(String.self, forKey: key) {
|
||||
return stringVal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user