Code Monkey home page Code Monkey logo

passwordtextfield's Introduction

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.

passwordtextfield's People

Contributors

bre7 avatar kennytm avatar kmiloaguilar avatar leopic avatar lfarah avatar pixel16 avatar ricky641 avatar sergeypetrachkov avatar star-s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

passwordtextfield's Issues

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?

Swift 3

it'd be cool to have a swift 3 version, if you have any interest to create a branch i would like to help with that.

Stored properties cannot be marked unavailable with '@available'

Hi everyone, I have this version, I tried to update version but it seems this is the last one available
pod 'PasswordTextField','1.2.0'

My project can't compile because of this error
Stored properties cannot be marked unavailable with '@available'
/**
* Shows the toggle button while editing, never, or always. The possible values to set are "editing", "never", "always
/
@available(
, unavailable, message: "This property is reserved for Interface Builder. Use 'showButtonWhile' instead.")
@IBInspectable var showToggleButtonWhile: String? {
willSet {
if let newShow = ShowButtonWhile(rawValue: newValue?.lowercased() ?? "") {
self.showButtonWhile = newShow
}
}
}

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 .

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.

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?

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.

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).

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'

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.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.