Giter Site home page Giter Site logo

hideshowpasswordtextfield's Introduction

HideShowPasswordTextField

An easy to use UITextField subclass that adds a visibility toggle and an optional validation checkmark

Created by @lookatpete (product), @pklada (design), and @miketsprague (code)

gif

Installation

Cocoapods

pod 'HideShowPasswordTextField', :git => 'https://github.com/Guidebook/HideShowPasswordTextField'

Manual

Just add the files in HideShowPasswordTextField/ to your project.

Usage

  • Create a UITextField in your xib, and change the class name to HideShowPasswordTextField. Or, create it programatically.
  • Set secureTextEntry to true, if you want the password to hide by default.
  • [Recommended] Change the border style to None, and add a height constraint of 44 or larger. The assets in this project are optimized for 44px, although larger is fine too. Smaller sizes might have clipping issues on the icons.
  • Implement UITextFieldDelegate and forward textField shouldChangeCharactersInRange and textFieldDidEndEditing to your password text field (see the example). We have to do this to get the behavior to work right--apple's API doesn't play very nice switching between secureTextEntry states.
    • This step is no longer necessary.
  • [Optional] Implement HideShowPasswordTextFieldDelegate to show the validation checkbox.
  • Customize the textField to your liking (the tint too!)!

hideshowpasswordtextfield's People

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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hideshowpasswordtextfield's Issues

How to integrate this in SwiftUI

Can you write a guide for integrating this into SwiftUI application? Like how to implement UIViewRepresentable and Coordinator?

Thanks.

Update Demo Project to use Swift 4.0+

Are there plans to update the demo project?
I attempted a dry run and the project runs but the UI/UX is not perfect. Its a white out with the text field and eyeball icon being barely visible on a simulator ๐Ÿ˜ข

ios-hideshow

Make class public

Class and methods needs to be made public for it to work out of the box

UIImage(named:) cannot be used when installed as Pod

Hi,

I have just added the pod to my project and it crashed when running it. Problem is, that UIImage(named:) cannot/should not be used within a pod. It searches the images within the default / app bundle while it located in the pod bundle.

Solution 1: Manually add the images to the main app bundle
Solution 2: Use UIImage(named:in:compatibleWith:) instead

let bundle = Bundle(for: PasswordToggleVisibilityView.self)
self.eyeOpenedImage` = UIImage(named: "ic_eye_open", in: bundle, compatibleWith: nil)!.withRenderingMode(.alwaysTemplate)

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.