FWFormViewModel

final class FWFormViewModel

A representation of the FWForm‘s ViewModel.

Properties

  • Responsible for providing a communication between the FWFormViewModel and its View.

    Declaration

    Swift

    weak var delegate: FWFormViewModelDelegate

Init

  • Initializes a new instance of this type.

    Declaration

    Swift

    init(configuration: FWConfiguration)

    Parameters

    configuration

    The configuration used to create a form.

  • The form’s title.

    Declaration

    Swift

    var title: String
  • The number of components on the form.

    Declaration

    Swift

    var numberOfComponents: Int { get }
  • The form’s color style.

    Declaration

    Swift

    var style: FWStyle
  • Returns the component’s ViewModel for the given index.

    Declaration

    Swift

    func viewModelAt(index: IndexPath) -> FWComponentViewModel
  • Submits answers if every component is valid.

    Declaration

    Swift

    func submit() -> Result<FWFormSnapshot, Error>
  • Sets the form up using the FWConfiguration passed as a paremeter in the FWFormViewModel init.

    Declaration

    Swift

    func setUp()