FloatableTextField
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Swift version 4.0+
Xcode 9.0+
Installation
FloatableTextField is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'FloatableTextField'
Usage
- Add a TextField in your viewcontroller view.
- Set the class for the TextField to FloatableTextField
- Create an outlet for the textField in your viewcontroller class
@IBOutlet weak var floatTextField: FloatableTextField!
FloatableTextFieldDelegate
FloatableTextFieldDelegate is similar as UITextFieldDelegate.
floatTextField.floatableDelegate = self
Set State Icon
In order to enable the state icon, add the Footer Image as defaultImage.png in yout Attribute Inspector.
Set State message
func setState(_ state: State, with message: String = "")
For Default Message
floatTextField.setState(.DEFAULT, with: "Default State Message")
Enable State Button Action
You can configure state button action to display your own info or popups.
floatTextField.onStateButtonClick = {
// Action
}
Enable DropDown
To enable DropDown you jst have to set the Is DropDown Enbaled to Yes in your attribute inspector And configure the dropDown Action as following in your view controller
floatTextField.onDropdownClick = {
// Action
}
Author
prashantLalShrestha, [email protected]
License
FloatableTextField is available under the MIT license. See the LICENSE file for more info.