Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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