Class
FormViewController
public final class FormViewController: UIViewController, UIScrollViewDelegate
A ViewController that displays FormItems.
Prefer to use make(configuration:items:submissionHandler:)
to create a FormViewController instance.
Relationships
Conforms To
UIScrollViewDelegate
UIViewController
Nested Type Aliases
FormValues
public typealias FormValues = [FormItem.Key: String]
A dictionary where the key is a key from an input and the value the value of that corresponding input field.
SubmissionClosure
public typealias SubmissionClosure = (FormViewController, FormValues) -> Void
A closure to handle form submissions.
Properties
onSubmit
public var onSubmit: SubmissionClosure
You can set this closure to be notified when the form is submitted.
Methods
make(configuration:_:)
public static func make(
configuration: FormConfiguration,
@FormBuilder _ items: () -> [FormItem]
) -> FormViewController
Creates a new FormViewController with a result builder. Make sure to set onSubmit after calling this method.
make(configuration:items:submissionHandler:)
public static func make(
configuration: FormConfiguration,
items: [FormItem],
submissionHandler: @escaping SubmissionClosure
) -> FormViewController
Creates a new FormViewController.
viewDidLoad()
public override func viewDidLoad()
viewDidAppear(_:)
public override func viewDidAppear(_ animated: Bool)
updateFields(_:)
public func updateFields(_ newFields: FormValues)
scrollViewDidScroll(_:)
@objc public func scrollViewDidScroll(_ scrollView: UIScrollView)