DefaultValue

enum DefaultValue

There are two types of default values: a constant and a generator. The latter is useful when the value must be determined at runtime.

  • Constant default value

    Declaration

    Swift

    case constant(ValueType)
  • Constant value that is provided at runtime (delayed)

    Declaration

    Swift

    case generator(() -> ValueType)
  • Obtain an actual default value. NOTE: for a generator type, this may not be idempotent.

    Declaration

    Swift

    var defaultValue: ValueType { get }