fernandacarvalho / FCTextField

A custom UITextField written in Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FCTextField

A custom UITextField with animations on 'didBeginEditing' and 'didEndEditing' events. It provides some icons for textfield's clearButton and support for your custom icon. This is written in Swift.


alt text


Features

  • BorderBottom animation
  • Custom borderBottom color for default state and active state in IB or programmatically
  • Custom clearButton alpha, color and icon

Installation

  • Swift Package Manager:
dependencies: [
    .package(url: "https://github.com/fernandacarvalho/FCTextField/tree/master/Package", .upToNextMajor(from: "1.0.0"))
]
  • Manually:

If you prefer not to use any dependency manager, you can find the binary framework on build folder and integrate FCTextField into your project manually.

Then, import FCTextField:

import FCTextField

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 FCTextField.
  4. Configure properties in the Attribute Inspector

If you want to show clearButton:

  1. Change 'Clear Button' property from 'Never appears' to 'Appears while editing'

  2. Create an IBOutlet in your class and set 'clearButtonType' property. You can choose between:

    • iosDefault (native icon)
    • simple
    • rounded
    • outlineRounded
    • arrow
    • outlineArrow
    • roundCorner
    • squareCorner
    • custom (user provides the image)

    Ex: myTextField.clearButtonType = .outlineRounded

  3. Choose the color and the alpha of the clearButton

If you choose ClearButtonType.custom:

  1. Set your image. Ex: myTextField.customClearButtonImage = yourImage
  • If the type isn't chosen, the .iosDefault will be applied and the ios native icon for clear button will appear.
  • If the type chosen is .custom but the image isn't provided, the ios native icon for clear button will appear.
  • You can see the usage in the ExampleApp

About

A custom UITextField written in Swift.


Languages

Language:Objective-C 69.6%Language:Swift 30.4%