Skip to content

Instantly share code, notes, and snippets.

@charlesmuchene
Created July 20, 2020 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesmuchene/7236c60ac8c7a8be1d909138cb7dbefb to your computer and use it in GitHub Desktop.
Save charlesmuchene/7236c60ac8c7a8be1d909138cb7dbefb to your computer and use it in GitHub Desktop.
Sample status code entity
struct StatusCode: CustomStringConvertible, Equatable {
let code: Int
var description: String
static let ok = StatusCode(code: 200, description: "Success")
static let unauthorized = StatusCode(code: 403, description: "Unauthorized")
static let invalidCredentials = StatusCode(code: 401, description: "Invalid credentials")
static func == (lhs: Int, rhs: StatusCode) -> Bool {
return lhs == rhs.code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment