CreationKit Documentation

Class Form​View​Controller

public final class FormViewController: UIViewController, UIScrollViewDelegate  

A ViewController that displays FormItems.

Prefer to use make(configuration:items:submissionHandler:) to create a FormViewController instance.

FormViewController FormViewController UIScrollViewDelegate UIScrollViewDelegate FormViewController->UIScrollViewDelegate UIViewController UIViewController FormViewController->UIViewController

Conforms To

UIScrollViewDelegate
UIViewController

Nested Type Aliases

Form​Values

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.

Submission​Closure

public typealias SubmissionClosure = (FormViewController, FormValues) -> Void

A closure to handle form submissions.

Properties

on​Submit

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:​submission​Handler:​)

public static func make(
    configuration: FormConfiguration,
    items: [FormItem],
    submissionHandler: @escaping SubmissionClosure
  ) -> FormViewController  

Creates a new FormViewController.

view​Did​Load()

public override func viewDidLoad()  

view​Did​Appear(_:​)

public override func viewDidAppear(_ animated: Bool)  

update​Fields(_:​)

public func updateFields(_ newFields: FormValues)  

scroll​View​Did​Scroll(_:​)

@objc public func scrollViewDidScroll(_ scrollView: UIScrollView)