MDCustomFormData

@objcMembers
public class MDCustomFormData : NSObject

Represents the complete configuration for a custom form.

An instance of this class holds all the components (MDAnyFormComponent) that make up the form, as well as properties for customizing its appearance (e.g., button colors, titles). You use this object to render the form, handle user input, and process submissions.

  • The unique identifier for the form.

    Declaration

    Swift

    public let formId: String
  • The color of the text on the submit button.

    Declaration

    Swift

    public let submitButtonTextColor: UIColor?
  • The background color of the submit button.

    Declaration

    Swift

    public let submitButtonBackgroundColor: UIColor?
  • The text displayed on the submit button.

    Declaration

    Swift

    public let submitButtonText: String?
  • The color of the form’s title text.

    Declaration

    Swift

    public let titleTextColor: UIColor?
  • The background color of the form’s title area.

    Declaration

    Swift

    public let titleBackgroundColor: UIColor?
  • The main title text of the form.

    Declaration

    Swift

    public let titleText: String?
  • The color of the title text in dark mode.

    Declaration

    Swift

    public let darkModeTitleTextColor: UIColor?
  • The background color of the title area in dark mode.

    Declaration

    Swift

    public let darkModeTitleBackgroundColor: UIColor?

Internal Properties

Public Methods

  • Registers a block to be executed whenever the form’s state changes, such as when a component’s visibility is updated.

    Use this method to build your initial UI and to update it in response to user input that affects conditional logic. The block will be called immediately upon registration with the initial state of the components.

    Declaration

    Swift

    public func onRender(block: @escaping ([MDFormComponent]) -> Void)

    Parameters

    block

    A block that receives an array of MDAnyFormComponent objects. You should iterate through this array to render or update your UI, paying attention to the isVisible property of each component.

  • Validates and submits the form data.

    This method first checks if all visible components have valid values. If they do, it submits the form data. If any component is invalid, the submission fails, and the method returns a result with an error message.

    Declaration

    Swift

    public func submitForm() -> MDFormSubmissionResult

    Return Value

    An MDFormSubmissionResult object indicating whether the submission was successful or not.

  • Informs the SDK that the user has dismissed or canceled the form without submitting it.

    You should call this method when the user navigates away from the form screen (e.g., by tapping a back button).

    Declaration

    Swift

    public func declineForm()