😑 using search-a-licious API now...

This commit is contained in:
cdricms
2025-12-06 18:43:14 +01:00
parent 44420002c7
commit dd191b585d
7 changed files with 35 additions and 23 deletions

View File

@@ -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
}
}