All Projects → NSHipster → Passwordrules

NSHipster / Passwordrules

Licence: mit
A Swift library for defining strong password generation rules

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Passwordrules

Uicollectionview Layouts Kit
📐 A set of custom layouts for UICollectionView with examples [Swift 5.3, iOS 12].
Stars: ✭ 410 (+45.91%)
Mutual labels:  uikit, safari
Kotlinwanandroid
Kotlin+模块化+响应式+MVVM 实现的风格简约、代码优雅的WanAndroid客户端
Stars: ✭ 265 (-5.69%)
Mutual labels:  uikit
AppUIKit
iOS interface design for macOS app
Stars: ✭ 25 (-91.1%)
Mutual labels:  uikit
laravel-starter-kit
A minimal starter kit for Laravel 8 using Bootstrap 5 and Webpixels CSS.
Stars: ✭ 23 (-91.81%)
Mutual labels:  uikit
nextly-template
Nextly Landing Page Template built with Next.js & TailwindCSS
Stars: ✭ 48 (-82.92%)
Mutual labels:  uikit
react-hooks-uikit-express-oauth-boiler-v2
A React/TypeScript fullstack boilerplate utilizing React hooks, using Express as backend, UIKit for frontend, MongoDB for storage & open-authenticator for OAuth.
Stars: ✭ 110 (-60.85%)
Mutual labels:  uikit
Themeable
Easy, type-safe UI theming in Swift
Stars: ✭ 38 (-86.48%)
Mutual labels:  uikit
Ezswiftextensions
😏 How Swift standard types and classes were supposed to work.
Stars: ✭ 2,911 (+935.94%)
Mutual labels:  uikit
mantine
React components library with native dark theme support
Stars: ✭ 4,390 (+1462.28%)
Mutual labels:  uikit
sodium-ui
Sodium is a simple, modular and customizable web component library to build elegant and accessible UI pieces for your React Application.
Stars: ✭ 23 (-91.81%)
Mutual labels:  uikit
LocaleManager
Changing iOS locale and language on the fly without exiting. RTL supported.
Stars: ✭ 51 (-81.85%)
Mutual labels:  uikit
monalisa-ui
MonalisaUI ✨ React Native UI Library
Stars: ✭ 37 (-86.83%)
Mutual labels:  uikit
postcss-momentum-scrolling
PostCSS plugin add 'momentum' style scrolling behavior (-webkit-overflow-scrolling: touch) for elements with overflow (scroll, auto) on iOS
Stars: ✭ 69 (-75.44%)
Mutual labels:  safari
availity-angular
Availity Angular SDK
Stars: ✭ 13 (-95.37%)
Mutual labels:  uikit
Userscripts
An open-source userscript editor for Safari
Stars: ✭ 261 (-7.12%)
Mutual labels:  safari
clockface
UI Kit for building Chronograf
Stars: ✭ 33 (-88.26%)
Mutual labels:  uikit
neutron
The easiest way to build Electron apps for OS X, Windows, Linux
Stars: ✭ 18 (-93.59%)
Mutual labels:  uikit
SafeAreaExample
The example project which allows you to play with safe areas introduced in iOS 11
Stars: ✭ 64 (-77.22%)
Mutual labels:  uikit
Verge
🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.
Stars: ✭ 273 (-2.85%)
Mutual labels:  uikit
Swiggyui
A Swiggy UI Clone Flutter App.
Stars: ✭ 258 (-8.19%)
Mutual labels:  uikit

PasswordRules

A Swift library for defining strong password generator rules.

This functionality is discussed in the NSHipster article Password Rules / UIText​Input​Password​Rules.


Requirements

  • Swift 4.0+

Installation

Swift Package Manager

Add the PasswordRules package to your target dependencies in Package.swift:

import PackageDescription

let package = Package(
  name: "YourProject",
  dependencies: [
    .package(
        url: "https://github.com/NSHipster/PasswordRules",
        from: "1.0.0"
    ),
  ]
)

Then run the swift build command to build your project.

Carthage

To use PasswordRules in your Xcode project using Carthage, specify it in Cartfile:

github "NSHipster/PasswordRules" ~> 1.0.0

Then run the carthage update command to build the framework, and drag the built PasswordRules.framework into your Xcode project.

Usage

Define an array of PasswordRules cases and use the descriptor(for:) method to create a string representation:

import PasswordRules

let rules: [PasswordRule] = [ .required(.upper),
                              .required(.lower),
                              .required(.special),
                              .minLength(20) ]

let descriptor = PasswordRule.descriptor(for: rules)
// "required: upper; required: lower; required: special; minlength: 20;"

Initialize a UITextInputPasswordRules object using the descriptor and pass that to the passwordRules property of a secure text field:

import UIKit

guard #available(iOS 12, *) else {
    fatalError()
}

self.passwordTextField.passwordRules =
    UITextInputPasswordRules(descriptor: descriptor)

License

MIT

Contact

NSHipster (@NSHipster)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].