Protocols

The following protocols are available globally.

  • Represents any Anatomy component that displays an image such as DSIcon and DSIllustration. This protocol is for identity uses only.

    See more

    Declaration

    Swift

    public protocol DSIconDisplayable
  • Represents the configuration of a DSTextField that handles the type of keyboard it uses as well as what’s allowed to be typed.

    See more

    Declaration

    Swift

    public protocol DSInputMask
  • Represents a delegate that is notified of when text has changed for a DSTextField. Extends UITextViewDelegate so all of those methods can be defined as well.

    See more

    Declaration

    Swift

    @objc
    public protocol DSTextFieldDelegate : UITextViewDelegate
  • Represents a validation of text entered into a DSTextField.

    Validation rules are added to DSTextField as follows:

    let textField = DSTextField()
    
    textField.add(validationRule: DSMaxTextLengthValidationRule(maxTextLength: 50, message: "Text too long."))
    

    All validation rules, and any you create, should accept empty text as valid. This is so new forms don’t show errors on all required fields right away. Once a form element is interacted with (didBeginEditing), you can then add a DSRequiredTextValidationRule so that if the field data is cleared it will display an error properly. Be careful to only add this rule once although there will be no issues if you do duplicate them. You can also call removeAllValidationRules if you want to reset everything.

    See more

    Declaration

    Swift

    public protocol DSValidationRule