Enumeration
FormItem
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
Enumeration Cases
textInput
case textInput(
configuration: FormConfiguration.TextInputConfiguration,
event: AnyPublisher<InputFieldState, Never>?,
validator: (String?) -> Validity
)
An input field that accepts text from a keyboard.
maskedTextInput
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.
dateInput
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.
textInputValidatingAsync
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.
sheetInput
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.
sheetInputValidatingAsync
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.
staticInputField
case staticInputField(
title: String?, subtitle: String?,
helper: String?,
text: String
)
A field that is static and the user cannot change.