Number
public enum Number : Codable, Hashable, CustomStringConvertible
A wrapper for standard numeric types.
-
Wraps an
Int
instance.Declaration
Swift
case int(Int)
-
Wraps a
Float
instance.Declaration
Swift
case float(Float)
-
Wraps a
Double
instance.Declaration
Swift
case double(Double)
-
Wraps a
Decimal
instance.Declaration
Swift
case decimal(Decimal)
-
See
Decodable.init(from:)
.Declaration
Swift
public init(from decoder: Decoder) throws
-
See
Encodable.encode(to:)
.Declaration
Swift
public func encode(to encoder: Encoder) throws
-
See
CustomStringConvertible.description
.Declaration
Swift
public var description: String { get }
-
See
ExpressibleByIntegerLiteral.init(integerLiteral:)
.Allows you to create an instance of
Number
with aInt
literal:let number: Number = 42 // Number.int(42)
Declaration
Swift
public init(integerLiteral value: Int)
-
See
ExpressibleByFloatLiteral.init(floatLiteral:)
.Allows you to create an instance of
Number
from aFloat
literal. The float type used isDouble
.let number: Number = 3.1415
Declaration
Swift
public init(floatLiteral value: Double)