Latest 2.0.4
Homepage https://github.com/mohsenShakiba/FormView
License MIT
Platforms ios 9.0
Dependencies CUITools, AdvancedTableView
Authors

Summery

This is a library for creating and managing form views

Components

FormView

Core view for showing and managing forms.
This view contains a UIScrollView which wraps a UIStackView inside.
The minimum height of stack view is the same as scroll view in order to allow the loading button to be aligned at the bottom of the view.

Methods & Propeties

  • .edgeInsets: UIEdgeInsets allows you to specify how much the formView places it’s subviews from sides. default : UIEdgeInsets(top: 24, left: 16, bottom: 24, right: 16)
  • .rowSpacing: CGFloat indicates the space for items in the stackView, default is 16 this applies to FormItem and accessories
  • .add(formItem: yourFormItem): adds the formItem at the end of formView
  • .insert(formItem: yourFormItem, at: index): inserts the formItem at the specified position
  • .add(accessory: yourAccessory): adds the accessory at the end of formView
  • .insert(formItem: yourAccessory, at: index): inserts the accessory at the specified position

FormViewController

Wraps the FormView inside a UIViewController with adidtional functionalities including keyboard handling
The FormView is accessible throught the formView of the controller

WARNING: do not use this controller with navigation controller

Methods & Propeties

  • .showError(message: String) showes an error message on the top of view for a short period of time
  • .enableHeader(title: String) creates a header with the given title, this will also sets the appropriate edgeInset for the header, so after calling this method don’t set the edgeInsets

Form Item

These are the items that can be used in the FormView

Custom FormItem

Each FormItem shoudl a subclass of FormItem.
If the custom class needs to be notified about the selection / deselection, it should also implement the appropriate methods.
but by default the FormItem is a subclass of UIControl so the user can set a selectot to be notifiied of the touch events.

TextFieldFormItem

Contains UITextField for user to write a single line string

  • title: String get / set the title for FormItem
  • value: String get / set the value for formItem
  • prompt: String get / set the prompt value for formItem

TextViewFormItem

Contains UITextView for user to write a multiline string

  • title: String get / set the title for FormItem
  • value: String get / set the value for formItem
  • prompt: String get / set the prompt value for formItem

SelectFormItem

Displays the value which is not editable
Use selector to get the touchUpInside event

  • title: String get / set the title for FormItem
  • value: String get / set the value for formItem
  • prompt: String get / set the prompt value for formItem

SelectImageFormItem

Displays the image which is selected by user
The image that is diplayed has 100 px size

  • set(image: UIImage) displays the given image
  • removeImage() removed the image and shows the default image

Accessories

FormLoadingButton

Wraps a LoadingButton
use add target for touchUpInside event

  • isLoading: Bool indicates wheter the button is loading
  • isEnabled: Bool indicates wheter the button is enabled
  • loadingButton: LoadingButton access to the original loadingButton

Known bugs and improvements

  • better header view
  • agnostic loading button
  • better error view
  • cancel button too big on iPhone SE

Author

mohsen shakiba, [email protected]

License

FormView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "FormView",
    "version": "2.0.4",
    "summary": "facilitates creating and managing forms in iOS Swift",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/mohsenShakiba/FormView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "mohsenShakiba": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mohsenShakiba/FormView.git",
        "tag": "2.0.4"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "FormView/Classes/**/*",
    "dependencies": {
        "CUITools": [],
        "AdvancedTableView": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This