Swiftpack.co - EvanCooper9/RxECNetworking as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by EvanCooper9.
EvanCooper9/RxECNetworking v1.0.1
An extension of ECNetworking. https://github.com/EvanCooper9/ECNetworking
⭐️ 0
🕓 1 year ago
.package(url: "https://github.com/EvanCooper9/RxECNetworking.git", from: "v1.0.1")

RxECNetworking

An extension of ECNetworking.

Installation

SPM

.package(url: "https://github.com/EvanCooper9/RxECNetworking", from: "2.0.0")

Usage

Sending Requests

Sending requests is reactive. Only the syntax is changed.

let request = ListUsersRequest(online: true)

network.send(request)
    .subscribe(onSuccess: { users in
        showUsers(users)
    })
    .disposed(by: disposeBag)

Actions

Actions are also reactive, all action protocols gain an Rx prefix, and require a DisposeBag.

struct AuthenticationAction: RxRequestWillBeginAction {
    
    let disposeBag = DisposeBag()

    func requestWillBegin(_ request: NetworkRequest) -> Single<NetworkRequest>
        guard request.requiresAuthentication else { .just(request) }
        // add authentication headers
        return .just(request)
    }
}

GitHub

link
Stars: 0
Last commit: 1 year ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Dependencies

Release Notes

1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics