Tuesday, 3 January 2017

Define Constants in Swift


 public struct HTTPStatus {
   
    // 1xx - Informational
    public struct Informational {
        public static let CONTINUE = 100
        public static let PROCESSING = 102
    }
   
   
   
    // 2xx Success
    public struct Success {
        public static let OK = 200
        public static let Created = 201
    }
   
   
    // 3xx Redirection
    public struct Redirection {
        public static let MultipleChoices = 300
        public static let MovedPermanently = 301
    }
   
   
    // 4xx Client Error
    public struct ClientError {
        public static let BadRequest = 400
        public static let Unauthorized = 401
    }
   
   
    // 5xx Server Error
    public struct ServerError {
        public static let InternalServerError = 500
        public static let NotImplemented = 401
    }
}

Define Constants in Swift

  public struct HTTPStatus {         // 1xx - Informational     public struct Informational {         public static let CONTINUE = ...