dtt

DTTextField

DTTextField is a custom textfield with floating placeholder and error label

Showing:

Popularity

Downloads/wk

0

GitHub Stars

240

Maintenance

Last Commit

1yr ago

Contributors

5

Package

Dependencies

0

License

MIT

Categories

Readme

DTTextField

Version License Awesome Platform Xcode

Demo

Introduction

DTTextField is a UITextField library with floating placeholder and error label.

Floating placeholder inspired from JVFloatLabeledTextField 👍.

Example

Clone the repo and run the example project from the Example directory.

Requirements

  • Xcode 11.0+
  • Swift 5.0+

Installation

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

pod 'DTTextField'

Usage

  1. Open a storyboard or Xib file.
  2. Drag and drop a UITextField to a ViewController.
  3. In Identity Inspector, replace the class from UITextField to DTTextField and the module to DTTextField.

Properties

Property nameTypeRemark
errorMessageStringAdd your error message to this property
errorFontUIFontChange font of error text
paddingYErrorLabelCGFloatError text top padding
floatPlaceholderColorUIColorTo change float placeholder color
floatPlaceholderActiveColorUIColorTo change float placeholder color while TextField is active(First responder)
floatPlaceholderFontUIFontChange font of float placeholder
paddingYFloatLabelCGFloatfloat placeholder top padding
placeholderColorUIColorchange placeholder color
animateFloatPlaceholderBoolanimate float placeholder label
hideErrorWhenEditingBoolhide error label when typing
floatingDisplayStatusenummaintain display status always, never, defaults

Important Properties

Property nameTypeRemark
dtLayerCALayerIf you want to formate DTTextField than use dtLayer property instead of layer (e.g. background color)
borderColorUIColorChange border color of DTTextField
canShowBorderBoolToggle border of DTTextField
dtborderStyleenumnone, rounded , sqare , top , bottom , left , right

Methods

Method NameRemark
showErrorto show error message
hideErrorto hide error message

Note

Don't give height constraint to DTTextField otherwise it won't work properly.

TODO

  • Add inbuilt validation

Author

Dhaval Thanki 😎

License

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

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100