TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Feb 2018 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Mohsen Shakiba.
Depends on: | |
CUITools | >= 0 |
AdvancedTableView | >= 0 |
This is a library for creating and managing form views
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.
.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 positionWraps 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
.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 edgeInsetsThese are the items that can be used in the FormView
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.
Contains UITextField for user to write a single line string
title: String
get / set the title for FormItemvalue: String
get / set the value for formItemprompt: String
get / set the prompt value for formItemContains UITextView for user to write a multiline string
title: String
get / set the title for FormItemvalue: String
get / set the value for formItemprompt: String
get / set the prompt value for formItemDisplays the value which is not editable
Use selector
to get the touchUpInside
event
title: String
get / set the title for FormItemvalue: String
get / set the value for formItemprompt: String
get / set the prompt value for formItemDisplays the image which is selected by user
The image that is diplayed has 100 px size
set(image: UIImage)
displays the given imageremoveImage()
removed the image and shows the default imageWraps a LoadingButton
use add target for touchUpInside event
isLoading: Bool
indicates wheter the button is loadingisEnabled: Bool
indicates wheter the button is enabledloadingButton: LoadingButton
access to the original loadingButtonmohsen shakiba, [email protected]
FormView is available under the MIT license. See the LICENSE file for more info.