Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Yevgen Sagidulin protspace

🎯
Focusing
Block or report user

Report or block protspace

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@protspace
protspace / UIAlertController+TextField.swift
Last active Jul 3, 2019 — 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/
View UIAlertController+TextField.swift
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)
View Builder patter + dot call
import UIKit
class ViewBuilder {
private var view = UIView()
func frame(_ frame: CGRect) -> ViewBuilder {
view.frame = frame
return self
}
View @autoclosure+UIView animation
import UIKit
extension UIView {
class func animate(_ animation: @autoclosure @escaping () -> Void, duration: TimeInterval = 0.25, delay: TimeInterval = 0) {
UIView.animate(withDuration: duration, delay: delay, animations: animation)
}
}
UIView.animate(self.label.alpha = 1)
You can’t perform that action at this time.