Skip to content

Instantly share code, notes, and snippets.

@onevcat
Created December 15, 2016 07:53
Show Gist options
  • Save onevcat/7f42bd010b4cba02928db2eb537c9cd0 to your computer and use it in GitHub Desktop.
Save onevcat/7f42bd010b4cba02928db2eb537c9cd0 to your computer and use it in GitHub Desktop.
struct DecodableArray<T: Decodable>: Decodable {
let value: [T]
static func parse(data: Data) -> DecodableArray<T> {
var value = [T]()
for subData in data {
let result = T.parse(data: data)
value.append(result)
}
return DecodableArray(value: value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment