This file contains 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
@discardableResult | |
private func performRequest<T:Decodable>(route: APIRouter, decoder: JSONDecoder = JSONDecoder(), completion:@escaping (Int, Result<T>)->Void) -> DataRequest { | |
return Alamofire.request(route).responseData() { responseData in | |
guard let response = responseData.response else { | |
completion(APIClient.responseErrorCode, .failure(ApiError.internalServerError(NSLocalizedString("service_error", comment: AppConstant.EMPTY)))) | |
return | |
} | |
This file contains 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
/* | |
I want to create a Cooler that supports many kind of drinks but the principals drinks are Jolt energy drinks for mine and caffeine free diet coke for my girlfriend. | |
If I took an incorrect drink, I will put it again in the cooler, If I took the correct one, I will drink it. | |
*/ | |
//using enums to limit the size of cans | |
enum DrinkSize { | |
case Can12 | |
case Can16 | |
case Can24 |