Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

Commit

Permalink
Conforms Array to CorvusResponse (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoogstraat authored Apr 23, 2020
1 parent cf6108b commit b934872
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Sources/Corvus/Endpoints/Utilities/Array+CorvusResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Allows ResponseModifier to work with Arrays of `CorvusResponse`
///
/// Instead of returning a single `CorvusResponse` an array of `CorvusResponse`
/// can be returned instead.
extension Array: CorvusResponse where Element: CorvusResponse {
public init(item: [Element.Item]) {
self = item.map { Element(item: $0) }
}
}

0 comments on commit b934872

Please sign in to comment.