Skip to content

Instantly share code, notes, and snippets.

extension Provider {
func requestEmpty<T: TargetType>(target: T) -> Observable<GravityResponse<Void>> {
requestData(target: target).then(decode)
}
private func decode(response: GravityResponse<Data>) -> Observable<GravityResponse<Void>> {
response.map { $0.map { _ in } }
.subscribe(on: ConcurrentDispatchQueueScheduler(qos: .utility))
.observe(on: MainScheduler.instance)
}
enum Either<T, U> {
case left(T)
case right(U)
}
...
/// Defines strategy to be used when determining if API response is `Empty`.
/// Available strategies are: 204 response code, 0 bytes and empty JSON container.
enum EmptyPredicate {