Created
September 18, 2022 21:02
-
-
Save emndeniz/411d0af1fb8d194bf6f1e603d858b88b to your computer and use it in GitHub Desktop.
SampleUsages
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
// For All countries | |
let serviceProvider: ServiceProvider<AllCountriesServices> = ServiceProvider<AllCountriesServices>() | |
serviceProvider.request(service: .all, decodeType: AllCountriesResponseModel.self) { result in | |
switch result { | |
case .success(let data): | |
print(data) | |
case .failure(let error): | |
print(error) | |
} | |
} | |
// For Any Querry Types | |
let serviceProvider2: ServiceProvider<QuerryCountriesServices> = ServiceProvider<QuerryCountriesServices>() | |
serviceProvider2.request(service: .name(name: "United Kingdom"), decodeType: CountryResponseModel.self) { | |
result in | |
switch result { | |
case .success(let data): | |
print(data) | |
case .failure(let error): | |
print(error) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment