Skip to content

Instantly share code, notes, and snippets.

View protspace's full-sized avatar
🎯
Focusing

Yevgen Sagidulin protspace

🎯
Focusing
View GitHub Profile
@protspace
protspace / UIAlertController+TextField.swift
Last active July 3, 2019 12:37 — forked from ole/UIAlertController+TextField.swift
Small modification of @OleB's UIAlertController extension for user authorization (login, password). Source: https://oleb.net/2018/uialertcontroller-textfield/
import UIKit
/// A validation rule for text input.
public enum TextValidationRule {
/// Any input is valid, including an empty string.
case noRestriction
/// The input must not be empty.
case nonEmpty
/// The enitre input must match a regular expression. A matching substring is not enough.
case regularExpression(NSRegularExpression)