Home

Awesome

GenericPasswordRow

<p align="left"> <a href="https://travis-ci.org/xmartlabs/GenericPasswordRow"><img src="https://travis-ci.org/EurekaCommunity/GenericPasswordRow.svg?branch=master" alt="Build status" /></a> <img src="https://img.shields.io/badge/platform-iOS-blue.svg?style=flat" alt="Platform iOS" /> <a href="https://developer.apple.com/swift"><img src="https://img.shields.io/badge/swift4-compatible-4BC51D.svg?style=flat" alt="Swift 4 compatible" /></a> <a href="https://github.com/Carthage/Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible" /></a> <a href="https://cocoapods.org/pods/GenericPasswordRow"><img src="https://img.shields.io/cocoapods/v/GenericPasswordRow.svg" alt="CocoaPods compatible" /></a> <a href="https://raw.githubusercontent.com/xmartlabs/GenericPasswordRow/master/LICENSE"><img src="http://img.shields.io/badge/license-MIT-blue.svg?style=flat" alt="License: MIT" /></a> </p>

By Xmartlabs SRL.

Contents

Introduction

GenericPasswordRow is a custom row for Eureka designed to create passwords. Its main purpose is to guide users through this process according to a set of validations.

<img src="Media/GenericPasswordRow.gif" width="450"/>

Usage

import Eureka
import GenericPasswordRow

class ViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        form +++ Section()
            <<< GenericPasswordRow()
    }
}

Requirements

Getting involved

Before contribute check the CONTRIBUTING file for more info.

If you use GenericPasswordRow in your app we would love to hear about it! Drop us a line on twitter.

Examples

Follow these steps to run Example project:

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install GenericPasswordRow, simply add the following line to your Podfile:

pod 'GenericPasswordRow', '~> 3.1'

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install GenericPasswordRow, simply add the following line to your Cartfile:

github "EurekaCommunity/GenericPasswordRow" ~> 3.1

Customization

For basic styling like fonts, colors, margins, separators you should use cellSetup and cellUpdate. Otherwise, you should be able to provide a completely different design (different nib file) and reuse the already implemented logic.

GenericPasswordRow parameters

For example you can do this:

<<< GenericPasswordRow() {
      $0.passwordValidator = // instantiate your custom validator
      $0.placeholder = "Create a password"
  }

GenericPasswordCell parameters:

Creating custom nib file

You might want to follow your own design. To accomplish this you should follow these steps:

Custom Strength View

If you are providing a custom nib file, you can also provide a custom subclass of PasswordStrengthView different from the DefaultPasswordStrengthView. You just need to implement the following methods:

class PasswordStrengthView: UIView {

    public func setPasswordValidator(validator: PasswordValidator) { }
    public func updateStrength(password password: String, animated: Bool = true) { }

}

Custom Password Validation

In order to provide a custom password validation you need to provide a conformance to the PasswordValidator protocol at the passwordValidator property of the GenericPasswordRow instance.

protocol PasswordValidator {

    var maxStrength: Double { get }
    func strengthForPassword(password: String) -> Double
    func hintForPassword(password: String) -> String?
    func isPasswordValid(password: String) -> Bool
    func colorsForStrengths() -> [Double: UIColor]

}

This validator should define the strength of any given password between zero and maxStrength values. Also, the func colorsForStrengths() -> [Double: UIColor] function should return a dictionary specifying key points of strength values and the associated color starting from there. See DefaultPasswordValidator.

Author

What is on the roadmap?

What could be added to GenericPasswordRow:

Change Log

This can be found in the CHANGELOG.md file.