ValidatedBinaryInteger

@available(swift 3.1)
public struct ValidatedBinaryInteger<Element> where Element : BinaryInteger

A ValidatedBinaryInteger is a model type that holds a Numeric value that has an associated valid flag.

ValidatedBinaryInteger provides feedback on validity of value

  • The value component of the ValidatedBinaryInteger.

    Declaration

    Swift

    public var value: Element
  • The validity of the ValidatedBinaryInteger.

    Declaration

    Swift

    public var valid: Bool
  • Create a ValidatedBinaryInteger given a specified value and unit.

    Declaration

    Swift

    public init(value: Element, valid: Bool)
  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public var debugDescription: String { get }
  • Declaration

    Swift

    public var customMirror: Mirror { get }
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Encodes this value into the given encoder.

    If the value fails to encode anything, encoder will encode an empty keyed container in its place.

    This function throws an error if any values are invalid for the given encoder’s format.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    The encoder to write data to.