ResponseStatusCode
@propertyWrapper
public struct ResponseStatusCode : Decodable
A property wrapper that provides a convenient way to handle response status codes.
The ResponseStatusCode
struct is a property wrapper that allows you to specify the status code for a response.
It wraps the UInt16
type and provides a default value of 0
.
Example usage:
@ResponseStatusCode var statusCode: UInt16
-
The wrapped value representing the status code.
This property holds the
UInt16
value that is managed by this property wrapper.Declaration
Swift
public var wrappedValue: UInt16
-
The projected value representing the HTTP status code.
This property provides a convenient way to access the
HTTPStatusCode
value corresponding to the wrapped value.Declaration
Swift
public var projectedValue: HTTPStatusCode? { get }
-
Initializes a new instance of
ResponseStatusCode
with the default value of0
.Example usage:
@ResponseStatusCode var statusCode: UInt16 = 0
Declaration
Swift
public init()
-
Initializes a new instance of
ResponseStatusCode
with the specified wrapped value.Example usage:
@ResponseStatusCode var statusCode: UInt16 = 200
Declaration
Swift
public init(wrappedValue: UInt16)
Parameters
wrappedValue
The wrapped value representing the status code.