Skip to content

A wrapper on UITextField with focus animation and utility methods. It also has modified HoshiTextField, taken from TextFieldEffect by Raúl Riera, a big thanks to him.

License

Notifications You must be signed in to change notification settings

s1Moinuddin/TextFieldWrapper

Repository files navigation

TextFieldWrapper

CI Status Version License Platform

What you can do?

- change font and color of placeholder
- limit textField input
- shake animation
- zoom in/out focus animation 
- character range validation
- Hoshi Effect with above feature
- closure callback of character change in textField
- closure callback of textFieldDidBeginEditing
- closure callback of textFieldDidEndEditing
- all other default features of UITextField!!!

Zoom animation

Clumsy view hierarchy

Zoom in TableViewCell

The Example app is cluttered to show how it performs in different/critical view hierarchy and situations. For better experience run the Example app.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

import TextFieldWrapper

implement zoom in/out:

yourTextField.zoomScale = 1.4 // some value > 1 for zoomIn effect.
yourTextField.addBlurToView = self.view // In which view you want to add transparent blur effect.

implement character changed event:

yourTextField.maxCharacter = 15
yourTextField.characterChangedEvent = { [weak self] (str, num) in
    // your implementation
}

Prevent Trimming and check validation

yourTextField.maxCharacter = 15
yourTextField.shouldTrim = false
yourTextField.characterChangedEvent = { [weak self] (str, num) in
// your implementation
}
let flag = yourTextField.isValid

shake animation can be accessed in 3 ways:

yourTextField.shake()
yourTextField.shake(borderColor: .red, borderWidth: 2.0)
yourTextField.shake(borderColor: .red, borderWidth: 4, completion: { 
[weak self] in
//your implementation
})

run the Example project, you will have a clean idea.

Requirements

iOS 9
Swift 3
Xcode 8

Installation

Pod

TextFieldWrapper is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TextFieldWrapper"

Manual

Just drag and drop the TextFieldWrapper folder to your project.

Author

S.M.Moinuddin, shuvn.eee@gmail.com

License

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

About

A wrapper on UITextField with focus animation and utility methods. It also has modified HoshiTextField, taken from TextFieldEffect by Raúl Riera, a big thanks to him.

Resources

License

Stars

Watchers

Forks

Packages