Value
public struct Value : ExpressibleByStringLiteral, ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral, CustomStringConvertible, Equatable, Hashable
A RequestHeaders.Value is a value type used to describe values in a header dictionary.
You can create values in a few ways:
- Using any type that conforms to
RawRepresentablewhereRawValueisString - Using any type that conforms to
CustomStringConvertible - Using strings or string literals
- Using integer literals
- Using floating point literals
Commonly used values and additional factory methods are declared in an extension to reduce boilerplate and increase type safety.
-
Create a
Valuefrom aCustomStringConvertibleDeclaration
Swift
public init<T>(_ value: T) where T : CustomStringConvertibleParameters
valueThe string convertible value
-
Create a
Valuefrom aRawRepresentableDeclaration
Swift
public init<T>(_ value: T) where T : RawRepresentable, T.RawValue == StringParameters
valueThe raw representable value
-
Create a
Valuefrom aStringDeclaration
Swift
public init(_ value: String)Parameters
valueThe string
-
Declaration
Swift
public let description: String
-
Declaration
Swift
public typealias StringLiteralType = String -
Declaration
Swift
public init(stringLiteral value: String)
-
Declaration
Swift
public typealias IntegerLiteralType = Int -
Declaration
Swift
public init(integerLiteral value: Int)
-
Declaration
Swift
public typealias FloatLiteralType = Double -
Declaration
Swift
public init(floatLiteral value: Double)
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public static func == (lhs: Value, rhs: Value) -> Bool
-
Create a header value from a
StringDeclaration
Swift
static func string(_ value: String) -> RequestHeaders.ValueParameters
valueThe
StringvalueReturn Value
The header value
-
Create a header from an
IntDeclaration
Swift
static func int(_ value: Int) -> RequestHeaders.ValueParameters
valueThe
IntvalueReturn Value
The header value
-
Create a header from a
DoubleDeclaration
Swift
static func double(_ value: Double) -> RequestHeaders.ValueParameters
valueThe
DoublevalueReturn Value
The header value
-
A value for the
Content-Typeheader fieldDeclaration
Swift
static func contentType(_ contentType: ContentType) -> RequestHeaders.ValueParameters
contentTypeThe content type value
Return Value
The header value
-
A value for the
Cache-Controlheader fieldDeclaration
Swift
static func cacheControlType(_ type: CacheControlType) -> RequestHeaders.ValueParameters
typeThe cache control typr
Return Value
The header value
View on GitHub
Install in Dash
Value Structure Reference