FieldNumber

@objcMembers public final class FieldNumber: Field

Text field for inputting a number value.

  • The number value of the field.

    When setting this field, the resulting value may differ from the original value, in order to adapt to the self.minimumValue, self.maximumValue, and self.precision constraints.

    Declaration

    Swift

    public var value: Double
  • The localized text representation of self.value

    Declaration

    Swift

    public var textValue: String
  • The minimum value of self.value. If nil, self.value is unconstrained by a minimum value.

    Declaration

    Swift

    public fileprivate(set) var minimumValue: Double? = nil
  • The maximum value of self.value. If nil, self.value is unconstrained by a maximum value.

    Declaration

    Swift

    public fileprivate(set) var maximumValue: Double? = nil
  • The precision of the value allowed by this field.

    self.value must be a multiple of self.precision. Precision is usually expressed as a power of 10 (e.g., 1, 100, 0.01), though other useful examples might be 5, 20, or 25.

    If nil, self.value is unconstrained by a precision value.

    Declaration

    Swift

    public fileprivate(set) var precision: Double? = nil
  • Flag indicating if self.value is constrained to being an integer value.

    Declaration

    Swift

    public var isInteger: Bool
  • Initializes the number field.

    Declaration

    Swift

    public init(name: String, value: Double)
  • Sets self.value from the given text, using the current default locale.

    Declaration

    Swift

    public func setValueFromLocalizedText(_ text: String) -> Bool

    Return Value

    true if the value was set successfully using the localized text, or false otherwise.

  • Sets self.minimumValue, self.maximumValue, and self.precision based on given values, forcing self.value to conform to these constraints.

    Throws

    BlocklyError: Thrown if invalid parameter values are passed for constraints.

    Declaration

    Swift

    public func setConstraints(minimum: Double?, maximum: Double?, precision: Double?) throws