Created
October 9, 2021 19:26
-
-
Save rorodriguez116/249597c7df909f3d25d0c6cc8da22426 to your computer and use it in GitHub Desktop.
Rapide-how-to-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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