Index

RBFormView.swift

Protocols

Classes


RBFormViewFieldValidationResult

The result of custom validation for a field.

Properties

Whether or not the field validates.
public var validates Bool { get set }

The optional failure message to be used when the field is invalid.
public var failureMessage String? { get set }


RBFormView

A view that provides a managed form. Note the UIViews attached to this via the form schema have their delegates set this instance in order to provide the automation necessary.

Properties

A delegate to receive form events.
public weak var delegate RBFormViewDelegate? { get set }

The RBPositioner to handle the layout of form elements. Default = RBGridPositioner with values spacing = 0, dimensions = 1, margin = [0, 0, 0, 0], orientation = RBOrientationVertical, sizing = RBGridPositionerSizeEvenly.
public var positioner RBPositioner { get set }

The UIScrollView to scroll and adjust when managing fields and input views. If nil, the layout view of the form itself is used. Default is nil.
public weak var scroller UIScrollView? { get set }

The UIModalTransitionStyle to use when displaying any modals such as the photo picker. Default = UIModalTransitionStyleCoverVertical.
public var modalTransitionStyle UIModalTransitionStyle { get set }

The toolbar to be used on input views when editing form fields.
public var formInputToolbar CGRect(x: 0, y: 0, width: 320, height: 45)) { get }

Whether or n\ot the toolbar should be used on input views. Default = YES.
public var toolbarEnabled Bool { get set }

The current value of the form fields. If hidden form fields are present the initial values of these fields will be included when calling this property. Note setting hidden form fields using this property has no effect.
public var values [String: Any] { get set }

Functions

Retrieves the item schema for the given identifier.
@param identifier : The identifer of the schema item object.
@returns The RBFormItemSchema object.
public func itemSchema(_ identifier: String) -> RBFormItemSchema?

Retrieves the item schema for the given identifier.
@param identifier : The identifer of the schema field object.
@returns The RBFormItemSchema object.
public func fieldSchema(_ identifier: String) -> RBFormFieldSchema?

Returns the UIView for the schema matching the given identifier.
@param identifier : The identifier of the schema item object.
@returns The UIView for the given identifier.
public func view(_ identifier: String) -> UIView?

Updates the form using the given schema.
@param formSchema : The RBFormSchema object.
public func setFormSchema(_ formSchema: RBFormSchema)

Updates the form using the given schema.
@param formSchema : The RBFormSchema object.
@param positioner : A postioner, you are required to pass this if using schema based positioners e.g. RBFlexiPositioner.
public func setFormSchema(_ formSchema: RBFormSchema, _ positioner: RBPositioner)

Resets the form fields to the initial values specified in the schema.
public func resetToInitialValues()

Updates the current value of the (non hidden) form fields with the given values dictionary.
@param values : The dictionary of specific values you would like to update. Pass NSNull for values you would like to remove.
public func updateValues(_ values: [String: Any])

Opens the keyboard/inputview on the first editable field.
public func selectFirstField()

Opens the keyboard/inputview on the editable field with the given identifier.
@param identifier : The name of the field to select for editing.
public func selectField(_ identifier: String)

Runs validation for the field with the given identifier.
@param identifier : The field identifier.
@returns Whether or not the field validated.
public func validateField(_ identifier: String) -> Bool

Runs validation on the form, returning the result.
@param serially : Perform validation serially stopping at the first invalid field.
@param present : Present tooltip/toast (as set via validationViewType) and move to the first invalid field encountered.
@returns Whether or not the form is valid.
public func validateForm(_ serially: Bool, present: Bool) -> Bool

Submits the form, prompting validation and delegate calls if successful.
@returns Whether or not the form validated and was submitted.
public func submitForm() -> Bool

Cancels the form, calling the delegate method.
public func cancelForm()

public func keyboardWillOpen(withFrame frame: CGRect)

public func keyboardWillHide()

public func closeKeyboard(_ completion: (() -> Void)?)

public func textFieldDidBeginEditing(_ textField: UITextField)

public func textFieldDidEndEditing(_ textField: UITextField)

public func textFieldShouldClear(_ textField: UITextField) -> Bool

public func textFieldShouldReturn(_ textField: UITextField) -> Bool

public func textViewDidBeginEditing(_ textView: UITextView)

public func textViewDidEndEditing(_ textView: UITextView)

public func cameraSelected(with photoView: RBPhotoView)

public func librarySelected(with photoView: RBPhotoView)

public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])

public func controlValueWillChange(to controlValue: Any?, from fromControlValue: Any?, withField field: UIView)

public func controlValueDidChange(to controlValue: Any?, from fromControlValue: Any?, withField field: UIView)