Go to file
Alexey Gerasimov 51067b408f
Merge pull request #13 from TouchInstinct/feature/swift4.2
Fixed for Swift4.2
2018-10-16 11:17:37 +03:00
Example Fixed for Swift4.2 2018-10-16 11:07:28 +03:00
UIAnimatedTextField Fixed for Swift4.2 2018-10-16 11:07:28 +03:00
.gitignore Add workspace and edit gitignore (ignore pods folder) 2016-12-19 18:32:45 +03:00
.swift-version Add swift version 2017-12-04 11:50:30 +03:00
CHANGELOG.md Update for setting date 2017-10-18 02:43:44 +03:00
LICENSE Add license to all source files 2016-12-19 19:33:48 +03:00
README.md Edit read 2016-12-20 19:35:55 +03:00
UIAnimatedTextField.podspec Fixed for Swift4.2 2018-10-16 11:07:28 +03:00

README.md

UIAnimatedTextField

This custom control can be used as a replacement for UITextField. When an user taps on it, a placeholder rises smoothly. It comes with 5 different text types: simple, password, url, tappable, date.

Installation

UIAnimatedTextField is available through CocoaPods. To install it, simply add the pod 'UIAnimatedTextField' and the source for podspecs to your Podfile. For example:

source "https://github.com/iznv/Podspecs.git"

platform :ios, '9.0'
use_frameworks!

target "ProjectName" do
    pod 'UIAnimatedTextField', '0.1.7'
end

Usage

Set height of UIView to 50 (optionally, to make UIAnimatedTextField look pretty). Create IBOutlet:

@IBOutlet weak var textField: UIAnimatedTextField!

In order to enable placeholder, set placeholder property:

textField.placeholder = "Enter something"

Simple type

By default you use simple type. It is just a text field.

Password type

In order to use UIAnimatedTextField for password input, specify its type as .password

textField.type = .password

Date type

In order to use UIAnimatedTextField for date input, specify its type as .date

textField.type = .date

Also you can set date format and done button title:

// "Done" by default
textField.doneTitle = "Ok"
// "dd/MM/YYYY" by default
textField.dateFormat = "dd MMMM YYYY"

Tappable type

In order to choose somewhere something that will be displayed in text field, specify type as .tappable and designate an action, for example:

textField.type = .tappable(action: {textField in textField.text = "Selected thing" })

Tap on the field, do an action, display a result in text field.

Customization

Color

You can change color of placeholder, entered text, line like this:

textField.placeholderTopColor = .blue
textField.placeholderBottomColor = .brown

textField.enteredTextColor = .orange

textField.lineColor = .green

Result:

Text Alignment

In order to change text alignment of placeholder and text field use this property:

textField.isLeftTextAlignment = true

Result:

License

Copyright (c) 2016 Touch Instinct

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