Skip to content

Instantly share code, notes, and snippets.

@charlieInDen
Created January 29, 2019 11:21
Show Gist options
  • Save charlieInDen/28283dd8c2f6c83b4eeae6d9a968ce2e to your computer and use it in GitHub Desktop.
Save charlieInDen/28283dd8c2f6c83b4eeae6d9a968ce2e to your computer and use it in GitHub Desktop.
API Request Protocol - Code restructuring so that unit test cases can be written for code
protocol APIRequest {
associatedtype RequestDataType
associatedtype ResponseDataType
func makeRequest(from data: RequestDataType) throws -> URLRequest
func parseResponse(data: Data) throws -> ResponseDataType
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment