CreationKit Documentation

Enumeration Form​Item

public enum FormItem  

An item that can be placed in a Form.

This type contains input fields, such as textInput, and sheetInput for user input. It also contains items for static text such as headers, and static fields.

All input items can be configured with a title and subtitle that will be displayed above the input field. Set these to nil, if you don't want a title or subtitle to be displayed.

Placeholders are required. If you set the placeholder to an empty string, CreationKit will place it's own placeholder for you.

Each item also accepts a validator function that will be called to validate the field. If you return .invalid, CreationKit will update the state of the item to show it's error state.

Nested Type Aliases

Key

public typealias Key = String

A unique key for each item placed into the Form.

Enumeration Cases

text​Input

case textInput(
        configuration: FormConfiguration.TextInputConfiguration,
        event: AnyPublisher<InputFieldState, Never>?,
        validator: (String?) -> Validity
       ) 

An input field that accepts text from a keyboard.

masked​Text​Input

case maskedTextInput(
        configuration: FormConfiguration.TextInputConfiguration,
        event: AnyPublisher<InputFieldState, Never>?,
        mask: Mask,
        validator: (String?) -> Validity
       ) 

An input field that accepts text from a keyboard. This will also mask the inputted text.

date​Input

case dateInput(
        configuration: FormConfiguration.DateInputConfiguration,
        event: AnyPublisher<InputFieldState, Never>?,
        validator: ([Date]?) -> Validity
      ) 

An input field that accepts dates from a date picker.

If you need a range of dates (start to end), enable allowsMultipleSelection & useRangeSelection in the datePickerConfiguration.

text​Input​Validating​Async

case textInputValidatingAsync(
        configuration: FormConfiguration.TextInputConfiguration,
        event: AnyPublisher<InputFieldState, Never>?,
        validator: (String?, @escaping (Validity) -> Void) -> Void
       ) 

An input field that accepts text from a keyboard. This item will validate asynchronously. This is useful if you need to make an API call to validate the input. The validator closure will send you the value to validate, and a completion handler that you must call when you are finished validating the value.

sheet​Input

case sheetInput(
        title: String?, subtitle: String?, sheetTitle: String? = nil,
        selectedItem: String?, placeholder: String, helper: String?,
        isOptionalField: Bool = false,
        event: AnyPublisher<InputFieldState, Never>?,
        selectableItems: [String], sheetItemTitles: [String]? = nil,
        key: Key,
        validator: (_ selectedItem: String?) -> Validity
       ) 

An input field that accepts a value from an action sheet.

sheet​Input​Validating​Async

case sheetInputValidatingAsync(
        title: String?, subtitle: String?, sheetTitle: String? = nil,
        selectedItem: String?, placeholder: String, helper: String?,
        isOptionalField: Bool = false,
        selectableItems: [String], sheetItemTitles: [String]? = nil, event: AnyPublisher<InputFieldState, Never>?,
        key: Key,
        validator: (_ selectedItem: String?, @escaping (Validity) -> Void) -> Void
       ) 

An input field that accepts a value from an action sheet. This item will validate asynchronously. This is useful if you need to make an API call to validate the input. The validator closure will send you the value to validate, and a completion handler that you must call when you are finished validating the value.

static​Input​Field

case staticInputField(
        title: String?, subtitle: String?,
        helper: String?,
        text: String
       ) 

A field that is static and the user cannot change.

heading

case heading(text: String) 

A header that uses the Heading 20px font

subheading

case subheading(text: String) 

A sub header that uses the SubHeading 18px font

text​Body

case textBody(text: String) 

A body text that uses the FontManager.shared.body 16px font

custom

case custom(view: UIView) 

An item that allows you to display a custom view in the form.