Skip to content

Latest commit

 

History

History
101 lines (67 loc) · 3.09 KB

README.md

File metadata and controls

101 lines (67 loc) · 3.09 KB

RevealTextField

iOS

Platform CocoaPods Carthage Compatible

Simple extension to add a reveal button to your boring UITextField

Requirements

  • iOS 8.0+
  • Swift 3.0+
  • Xcode 8.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required to build RevealTextField 1.0.3+.

To integrate RevealTextField into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'RevealTextField', '~> 1.0.3'

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate RevealTextField into your Xcode project using Carthage, specify it in your Cartfile:

github "LeonardoCardoso/RevealTextField" ~> 1.0.3

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate RevealTextField into your project manually.

Usage

You can use a RevealTextField on any UITextField by just calling the function revealable(). Yes it's an extension, not a subclass:

let passwordTextField = UITextField()
passwordTextField.isSecureTextEntry = true
passwordTextField.revealable() // <<---

Customizing

passwordTextField.revealable(secureImage: UIImage?,     // <<--- isSecureTextEntry == true. 
                             unsecureImage: UIImage?,   // <<--- isSecureTextEntry == false.
                             tintColor: UIColor?,       // <<--- image color, default is black.
                             dimension: CGFloat?)       // <<--- image dimension, default is 30.

Functions

  • revealable() transforms your boring UITextField into a Revealing UITextField.
  • toggleReveal() toggles the review automatically at any time. It applies to every UITextField.
  • toggleImage(_ isSecure: Bool) toggles revealing image at any time.

License

RevealTextField is released under the MIT license. See LICENSE for details.

Follow me for the latest updates