• Stars
    star
    310
  • Rank 134,926 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

RevealingSplashView

A Splash view that animates and reveals its content, inspired by Twitter splash
Swift
1,249
star
2

IBLocalizable

Localize your views directly in Interface Builder with IBLocalizable
Swift
459
star
3

SnakeClassic

A snake engine written in SpriteKit for all Apple devices.
Swift
73
star
4

CountItApp

Count It, Never lose the count again
Swift
66
star
5

VideoBackgroundViewController

A View Controller that shows a video in the background, like Spotify
Swift
41
star
6

SwiftTMDB

A sample movie app that I build to play with Swift, Alamofire, Moya, RxViewModel, RxSwift, etc
Swift
29
star
7

SwiftMailgun

SwiftMailgun provides simple alternative when you need to send an email with your iOS app using MailGun
Swift
21
star
8

SendToMe

Share content to your email with a single tap
Swift
18
star
9

buddybuild-dashboard

Present your most important BuddyBuild builds in a TV
JavaScript
11
star
10

SwiftMandrill

SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
Swift
11
star
11

appstore-rating-dashboard

Display and keep in check your App Store ratings and reviews with this dashboard
JavaScript
7
star
12

SwiftDelayer

Simple GCD delayer wrapper written in Swift
Swift
6
star
13

hubot-insults

Tastefully, insult your colleagues with Hubot
CoffeeScript
3
star
14

InterviewProgrammingQuestionSwift

Some popular interview programming questions solved in Swift
Swift
2
star
15

hubot-reactions

Hubot shows awesome reactions GIFs to compliment your teammates
CoffeeScript
2
star
16

CuentaleASubwayFreeCookie

You want a free Cookie Mothafuka?
1
star
17

MealPlanExchanges

Repository for the Meal Plan Exchanges project
Swift
1
star
18

soincalculator

RPN Calculator Source for SOIN U iOS course
Objective-C
1
star
19

ParseUtilsJS

Just a small example of JS scripts that do stuff in a Parse.com instance. For example, migrate all users from a DB to Parse
JavaScript
1
star