UncertainValue
struct UncertainValue<T, U> : Codable where T : Decodable, T : Encodable, U : Decodable, U : Encodable
Handle JSON values that may be different values Such as possibly quoted numbers
-
First possible value
Declaration
Swift
var tValue: T?
-
Second possible value
Declaration
Swift
var uValue: U?
-
Convenience access to Int if present
Declaration
Swift
var intValue: Int? { get }
-
Convenience access to Double if present
Declaration
Swift
var doubleValue: Double? { get }
-
Initalize with first type
Declaration
Swift
init(with value: T)
Parameters
value
Value
-
Initalize with second type
Declaration
Swift
init(with value: U)
Parameters
value
Value
-
Initialize with decoder
Throws
Decoding errorDeclaration
Swift
init(from decoder: Decoder) throws
Parameters
decoder
Decoder
-
Encode to encoder
Throws
Encoding errorDeclaration
Swift
func encode(to encoder: Encoder) throws
Parameters
encoder
Encoder