Skip to content

Instantly share code, notes, and snippets.

@AlexanderNey
Last active August 29, 2015 14:23
Show Gist options
  • Save AlexanderNey/c0a54d57c8f7dc06372b to your computer and use it in GitHub Desktop.
Save AlexanderNey/c0a54d57c8f7dc06372b to your computer and use it in GitHub Desktop.
ARTICLE Function Composing Swift 2.0 - 2
enum JSONParseError : ErrorType {
case InvalideJSON
case UnexpectedCharacter(line: Int, column: Int)
}
enum ServerResponseError : ErrorType {
case InvalidResponse
case ErrorResponse(message: String)
}
enum UnmarshalResponseError : ErrorType {
case InvalidResponse
case ErrorResponse
}
func parseJSONFromNSData(data: NSData) throws -> JSON { ... }
func validateJSONResponse(json: JSON) throws -> JSON { ... }
func unmarshalJSON<T : Unmarshallable>(json: JSON, type: T.Type) throws -> T { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment