This library shows text fields with beautiful placeholder animation when are selected
To run the example project, clone the repo, and run pod install from the Example directory first.
- Swift 4.0 or higher
- iOS 8.0
- XCode 9.0
Install Cocoapods if need be.
$ gem install cocoapodsAdd FRTextFieldAnimation in your Podfile.
use_frameworks!
pod 'FRTextFieldAnimation'Then, run the following command.
$ pod installFind a sample code for iOS here.
import FRTextFieldAnimation@IBOutlet weak var textView: FRTextFieldAnimation!textView.placeHolderFont = UIFont.boldSystemFont(ofSize: 20)
textView.textFieldFont = UIFont.boldSystemFont(ofSize: 15)
textView.placeHolderTitle = "Phone number"
textView.placeHolderColor = UIColor.red
textView.lineColor = UIColor.purple
textView.textColor = UIColor.darkGray
textView.textLimit = 11
textView.keyboardType = .numberPadif you want to use textfield delegates methods
textView.delegate = selfextension ViewController: AnimatedTextInputDelegate {
func animatedTextInputDidEndEditing(animatedTextInput: FRTextFieldInput) {
//code
}
func animatedTextInputDidBeginEditing(animatedTextInput: FRTextFieldInput) {
//code
}
func animatedTextInputDidChange(animatedTextInput: FRTextFieldInput) {
//code
}
func animatedTextInputShouldReturn(animatedTextInput: FRTextFieldInput) -> Bool {
animatedTextInput.resignFirstResponder()
return true
}
func animatedTextInputShouldBeginEditing(animatedTextInput: FRTextFieldInput) -> Bool {
return true
}
func animatedTextInputShouldEndEditing(animatedTextInput: FRTextFieldInput) -> Bool {
return true
}
}Farshad Ghafari, farshad.de.lucia@gmail.com
FRTextFieldAnimation is available under the MIT license. See the LICENSE file for more info.