A custom TextField with a switchable icon which shows or hides the password and enforce good password policies

Overview

PasswordTextFieldBanner

Build Status codecov.io CocoaPods Compatible Carthage compatible Awesome GitHub license Language

PasswordTextField

A custom TextField with a switchable icon which shows or hides the password and enforces good password policies, written in Swift.

PasswordTextFieldGif

Features

  • Custom toggle icon in IB or programmatically.
  • Custom icon color in IB or programmatically.
  • Custom password validation rules.
  • Custom password validation error message.
  • Control when to show the icon, while editing, always or never.

:octocat: Installation

CocoaPods

You can use CocoaPods to install PasswordTextField by adding it to your Podfile:

platform :ios, '8.0'
use_frameworks!
pod 'PasswordTextField'

To get the full benefits import PasswordTextField wherever you import UIKit

import UIKit
import PasswordTextField

Carthage

Create a Cartfile that lists the framework and run carthage bootstrap. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/PasswordTextField.framework to an iOS project.

github "PiXeL16/PasswordTextField"

Manually

  1. Download and drop /PasswordTextField folder in your project.
  2. Congratulations!

🤘 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 PasswordTextField and the module to PasswordTextField.
  4. Configure your properties in the Attribute Inspector.

Screenshot

Properties

Property name Data type Remark
Show Toggle Button While String Possible values are editing(default), always, never
Image Tint Color UIColor The color off the Toggle image, the functionality use UIImageRenderingMode.AlwaysTemplate to change the default or custom image color
Custom Show Secure Text Image UIImage Your custom image to show the secure text
Custom Hide Secure Text Image UIImage Your custom image to hide the secure text

Validation

PasswordTextField also provides functionality to enforce good password policies.

It will currently validate that the password format is at least 8 characters long and contain one uppercase letter and one number.

import PasswordTextField

if passwordTextField.isInvalid(){
  print(passwordTextField.errorMessage)
}

You can also provide your custom password validation format (with Regex) and error message:

import PasswordTextField

let validationRule = RegexRule(regex:"^[A-Z ]+$", errorMessage: "Password must contain only uppercase letters")

passwordTextField.validationRule = validationRule

if passwordTextField.isInvalid(){
  print(passwordTextField.errorMessage)
}

TODO

  • Show indication when password is strong or weak in TextField
  • Animation when toggling Button

👽 Author

Chris Jimenez - http://code.chrisjimenez.net, @chrisjimeneznat

🍺 Donate

If you want to buy me a beer, you can donate to my coin addresses below:

BTC

1BeGBew4CBdLgUSmvoyiU1LrM99GpkXgkj

ETH

0xa59a3793E3Cb5f3B1AdE6887783D225EDf67192d

LTC

Ld6FB3Tqjf6B8iz9Gn9sMr7BnowAjSUXaV

License

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

Comments
  • Unknown class PasswordTextField in interface builder file.

    Unknown class PasswordTextField in interface builder file.

    when i am setting class for textfield in storyboard its showing "Unknown class".but when i am creating textfield with the class "PasswordTextField" its working fine.Here is an image...see this. screen shot 2016-07-28 at 10 19 12 am

    opened by commando24 8
  • Having trouble setting it up through Carthage

    Having trouble setting it up through Carthage

    Following the README.md installation using Carthage I am constantly being presented with Build Failed exit.

    The last messages in the log are as follows:

    Build system information
    error: /Users/user/folder/project/Carthage/Checkouts/PasswordTextField/Pods/Target Support Files/Pods-PasswordTextField/Pods-PasswordTextField.release.xcconfig: unable to open file (in target "PasswordTextField" in project "PasswordTextField") (in target 'PasswordTextField')
    
    ** ARCHIVE FAILED **
    

    I've cloned the PasswordTextField project, cleaned a few Pod references, added Quick&Nimble dependencies to Cartfile, build and ran the demo project without problems.

    Then used my local project as dependency for my project... still no luck.

    Any tips on how to resolve this would be much appreciated.

    opened by surpher 3
  • Icon not showing

    Icon not showing

    Hey!

    I implemented this control following the instructions and the eye icon is not showing on IB or in the app, even demo project doesn't work. I ran Debug View Hierarchy and no control is created along with the field.

    Here's what my field is set in Interface Builder: captura de tela 2016-10-19 as 06 49 15 captura de tela 2016-10-19 as 06 49 26

    Tested it with/without delegates, changin border styles, setting a default font, without any controls imported to project (to see if it's having some conflicting libraries) and no cigar.

    I'm using XCode 8 with Swift 3, imported the project via CocoaPods (1.0.4).

    opened by vancelopes 3
  • how to use this with carthage file

    how to use this with carthage file

    I am getting this error while i'm trying to update my cart file. Parse error: invalid GitHub repository identifier "PasswordTextField" Please clarify .

    opened by commando24 3
  • Image doesn't change for custom icon

    Image doesn't change for custom icon

    I have two images with different color (blue and gray) for CustomShow and CustomHide. The toggle button can be used to show & hide password but the icon always in gray. What should I do to fix that? Thanks.

    opened by dhafinmuktafin 2
  • Allow this to be actually used in Carthage.

    Allow this to be actually used in Carthage.

    • Do not integrate CocoaPods with the target PasswordTextField. This is unnecessary as the library itself has no dependencies.
    • Update the test dependencies Quick and Nimble to the latest published versions.

    Without this commit, using PasswordTextField in Carthage will fail with the following message, because PODS_ROOT is not defined in Carthage.

    *** Building scheme "PasswordTextField" in PasswordTextField.xcworkspace
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/kennytm/Library/Developer/Xcode/DerivedData/PasswordTextField-bpvizxblfrzvlofkzgiyvwgfekxy/Build/Intermediates/PasswordTextField.build/Release-iphoneos/PasswordTextField.build/Script-66B4D3588EF01B594E66967A.sh
    (1 failure)
    error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
    A shell task (/usr/bin/xcrun xcodebuild -workspace /path/to/my/project/Carthage/Checkouts/PasswordTextField/PasswordTextField.xcworkspace -scheme PasswordTextField -configuration Release -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
    ** BUILD FAILED **
    
    
    The following build commands failed:
    	PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/kennytm/Library/Developer/Xcode/DerivedData/PasswordTextField-bpvizxblfrzvlofkzgiyvwgfekxy/Build/Intermediates/PasswordTextField.build/Release-iphoneos/PasswordTextField.build/Script-66B4D3588EF01B594E66967A.sh
    (1 failure)
    
    opened by kennytm 2
  • When i add PasswordTextField xCode required describe SWIFT_VERSION

    When i add PasswordTextField xCode required describe SWIFT_VERSION

    “Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

    opened by probovik 2
  • Better Installation Section

    Better Installation Section

    Hey @PiXeL16, your library is really interesting.

    The only problem I found was the README.md, which can have a better Installation Section I created this iOS Open source Readme Template so you can take a look on how to better organize the Installation Section If you want, I can help you to do it.

    What are your thoughts?

    help wanted 
    opened by lfarah 1
  • Xcode reports

    Xcode reports "Couldn't find Assets.car"

    Since updating to Xcode 11.1 and iOS 13, (that's when I started to notice it anyway, not certain that this is the root cause) I'm seeing the following warning logged twice each time a PasswordTextField is rendered on a given iOS screen:

    [framework] CoreUI: RunTimeThemeRefForBundleIdentifierAndName() couldn't find Assets.car in bundle with identifier: 'org.cocoapods.PasswordTextField'

    opened by nashish 1
  • Eye icon getting hidden when text field not become a first responder

    Eye icon getting hidden when text field not become a first responder

    It is working fine for me but when my text field is not become a first responder that time the eye Icon is getting hidden again when I click on text field when it is become a first responder again it is showing me

    Expected behaviour:

    My Login Form contain 1) User Id 2) Password and 3) PAN/DOB, both Password and PAN/DOB fields are Secure text entry on this text fields I added PasswordTextField pod but when this text fields are not become a first responder the eye icon getting hidden. I want to keep that eye icon highlighted for all the time. Is there any way to do so.

    opened by digrase008 0
  • Crashing app after press show/hide while the keyboard is showing.

    Crashing app after press show/hide while the keyboard is showing.

    Crash in terminal: objc[16770]: Cannot form weak reference to instance (0x159e7d720) of class UICompatibilityInputViewController. It is possible that this object was over-released, or is in the process of deallocation.

    iPhone X - iOS 12. screenrecording_12-05-2018 13-35-37

    This error occurs after I click a few times to show and hide the password with the keyboard showing.

    Does anyone have a solution?

    opened by andre991 0
Owner
Chris Jimenez
I build Apps for your phone and tablets, also 📸, from 🇨🇷, in 🇩🇪
Chris Jimenez
Floating-textfield-swiftui - Floating textfield With SwiftUI

floating_textfield-swiftui Hey, Guys welcome to this tutorial. In this complete

null 1 Feb 11, 2022
DTTextField is a custom textfield with floating placeholder and error label

DTTextField Introduction DTTextField is a UITextField library with floating placeholder and error label. Floating placeholder inspired from JVFloatLab

Dhaval Thanki 310 Jan 5, 2023
Awesome TextField is a nice and simple libriary for iOS and Mac OSX

Awesome TextField is a nice and simple libriary for iOS and Mac OSX. It's highly customisable and easy-to-use tool. Works perfectly for any registration or login forms in your app.

Alexander Shoshiashvili 225 Nov 21, 2022
TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

TTextField is developed to help developers can initiate a fully standard textfield including title, placeholder and error message in fast and convinient way without having to write many lines of codes

Nguyen Duc Thinh 7 Aug 28, 2022
A Float Input View with smooth animation and supporting icon and seperator written with Swift

RSFloatInputView Features Smooth animation using CoreText Support optional left icon Support optional seperator Configurable padding, size, fonts and

null 103 Nov 13, 2022
Floating Label TextField for SwiftUI. FloatingLabelTextFieldSwiftUI

FloatingLabelTextFieldSwiftUI FloatingLabelTextFieldSwiftUI is a small and lightweight SwiftUI framework written in completely swiftUI (not using UIVi

Kishan Raja 337 Jan 2, 2023
A SwiftUI TextField with a prompt (or placeholder) that floats above the text field when active or not empty. Requires iOS 15.

FloatingPromptTextField A prompt is the label in a text field that informs the user about the kind of content the text field expects. In a default Tex

Emilio Peláez 43 Nov 3, 2022
A floating label style for SwiftUI's TextField.

FloatingLabelTextFieldStyle A floating label style for TextField with support for displaying error messages. Requirements iOS 15.0+ macOS 12.0+ Instal

Red Davis 13 Aug 22, 2022
Simple placeholder move textfield

PlaceholderTextField Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 11.0 o

null 6 Mar 9, 2022
Elegant SwiftUI phone number textField.

iPhoneNumberField ☎️ Format phone numbers as they're typed—entirely in SwiftUI. ?? Get Started | Examples | Customize | Features | Install | And it's

Seyed Mojtaba Hosseini Zeidabadi 358 Dec 30, 2022
An optional TextField Replacement for SwiftUI

TextInputView A TextField Replacement In his excellent YouTube tutorial series on Building SwiftUI Components, Peter Friese (@peterfriese on Twitter)

Stewart Lynch 6 Aug 9, 2022
This is the demo repository for having floating TextField in swift UI

ed-floating-field-swiftui This is the demo repository for having floating TextField in swift UI The inputs fields should not be empty Validations for

Patrick 1 May 26, 2022
TextField with DropDown support using UIPickerView

IQDropDownTextField TextField with DropDown support using UIPickerView Installing Install using cocoapods. Add in your Podfile: pod 'IQDropDownTextFie

Mohd Iftekhar Qurashi 301 Jun 29, 2022
TextField with smart suggestion

AutoCompleteTextField Features Provides a subclass of UITextField that has suggestion from input Has autocomplete input feature Data suggestion are pr

Neil Francis Ramirez Hipona 63 Nov 13, 2022
Library that allows you binding `enabled` property of button with textable elements (TextView, TextField)

What is NxEnabled? It's a fairly common case, when the enabled state of button depends on some textable elements such as TextView, TextField. So this

Nikita Ermolenko 33 Sep 20, 2021
Apple TextField created according to the Material.IO guidelines of 2019. Featured at Medium.

CocoaTextField Highly customizable text field created according to Material.IO guidelines. Minimum iOS version 11.0 Carthage github "edgar-zigis/Cocoa

Edgar Žigis 266 Nov 26, 2022
Subclass of UITextField that shows inline suggestions while typing.

AutocompleteField Subclass of UITextField that shows inline suggestions while typing. Plug and play replacement for UITextField. Delimiter support. Pe

Filip Stefansson 663 Dec 6, 2022
An auto-layout base UITextView subclass which automatically grows with user input and can be constrained by maximal and minimal height - all without a single line of code

Deprecated This library is no longer maintained and is deprecated. The repository might be removed at any point in the future. MBAutoGrowingTextView A

Matej Balantič 125 Jan 13, 2022
VMaskTextField is a library which create an input mask for iOS.

VMaskTextField An inputmask helps the user with the input by ensuring a predefined format. This can be useful for dates, numerics, phone numbers etc U

Vinícius Oliveira 384 Jul 20, 2022