Skip to content

Instantly share code, notes, and snippets.

@rorodriguez116
Created October 9, 2021 19:26
Show Gist options
  • Save rorodriguez116/249597c7df909f3d25d0c6cc8da22426 to your computer and use it in GitHub Desktop.
Save rorodriguez116/249597c7df909f3d25d0c6cc8da22426 to your computer and use it in GitHub Desktop.
Rapide-how-to-1
Rapide
.https
.host("openexhangerates.org")
.path("/api/convert/2000/GBP/EUR")
.authorization(.none)
.params(["app_id":"XYZ"])
.execute(.get, decoding: String.self, customErrorType: MyErrorType.self)
.sink { completion in
if case let .failure(error) = completion {
if let err = error as? MyErrorType {
// Handle your custom error
print(err.myCustomProperty)
} else {
// Handle error
print(error)
}
}
} receiveValue: { val in
// success
}
.store(in: &self.subscriptions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment