ADBindable

public protocol ADBindable

User Interface controls that conform to this protocol can be added to a ADBoundViewController Views or SubViews and their values will be automatically set and returned to a data model conforming to the Codable protocol based on the field or formula in a SQL like syntax specified in the dataPath property.

  • Defines the name of a field from the bound data model or a formula that will be used to populate the control. If the control is editable, this is also the field that the value will be written back to.

    Declaration

    Swift

    var dataPath: String
  • Defines the name of a field from the bound data model or a formula that will be used to enable or disable the control.

    Declaration

    Swift

    var enabledPath: String
  • Defines the name of a field from the bound data model or a formula that will be used to hide or show the control.

    Declaration

    Swift

    var hiddenPath: String
  • Provides a link to the ADBoundViewController that the control is bound to.

    Declaration

    Swift

    var controller: ADBoundViewController?
  • Provides a unique ID that is assigned to the control when it is bound to a ADBoundViewController.

    Declaration

    Swift

    var formID: Int
  • Returns true if the value of the control can be edited by the user, else returns false.

    Declaration

    Swift

    var isMutable: Bool
  • Populates the control with the given value. The value will automatically be cast to the correct type for the given control.

    Declaration

    Swift

    func setValue(_ value: Any)

    Parameters

    value

    The value to set the control to.

  • Sets the enabled/disabled state of the control with the value of the field from the bound data model or forumla.

    Declaration

    Swift

    func setEnabledState(_ value: Any)

    Parameters

    value

    The value to set the control to.

  • Sets the visible state of the control with the value of the field from the bound data model or forumla.

    Declaration

    Swift

    func setHiddenState(_ value: Any)

    Parameters

    value

    The value to set the control to.

  • Sets any control specific bound states (such as colors) with the values from the given ADRecord.

    Declaration

    Swift

    func setControlSpecificStates(against data: ADRecord)

    Parameters

    data

    The raw data to bind the additional states to.

  • Gets the value from the bound control in the native type that the control handles. For example: String for a UITextField.

    Declaration

    Swift

    func getValue() -> Any

    Return Value

    The current value of the control in its native type.