Better generics for LazilyDecoding

This commit is contained in:
Shadowfacts 2022-05-13 17:33:07 -04:00
parent cc0da2ec54
commit ecab33bdce
1 changed files with 2 additions and 2 deletions

View File

@ -58,8 +58,8 @@ public struct LazilyDecoding<Enclosing, Value: Codable> {
}
extension LazilyDecoding {
init(arrayFrom keyPath: ReferenceWritableKeyPath<Enclosing, Data?>) {
self.init(from: keyPath, fallback: [] as! Value)
init<T: Codable>(arrayFrom keyPath: ReferenceWritableKeyPath<Enclosing, Data?>) where Value == [T] {
self.init(from: keyPath, fallback: [])
}
}