Created
November 30, 2016 05:55
-
-
Save odrobnik/c7c88c69c88c289e4e0648792bfb66d4 to your computer and use it in GitHub Desktop.
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
public enum VanillaRequestError: Error | |
{ | |
case unexpectedResult(String) | |
case restfulError(NSError) | |
} | |
// the result from a Vanilla API request | |
public enum VanillaRequestResult<T> | |
{ | |
case success(T) | |
case failure(VanillaRequestError) | |
} | |
// variant that expects a single T | |
internal func responseProcessingDataTask<T: JSONInitializable>(_ request: URLRequest, resultsKey: String? = nil, completion: ((VanillaRequestResult<T>)->())?) -> URLSessionDataTask | |
{ | |
} | |
// variant that expects an array of T | |
internal func responseProcessingDataTask<T: JSONInitializable>(_ request: URLRequest, resultsKey: String? = nil, completion: ((VanillaRequestResult<[T]>)->())?) -> URLSessionDataTask | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment