Skip to content

Instantly share code, notes, and snippets.

View elenamene's full-sized avatar

Elena Meneghini elenamene

View GitHub Profile
@elenamene
elenamene / UIAlertController.swift
Created May 29, 2019 14:11 — forked from rodydavis/UIAlertController.swift
Swift 4 Alert Controller Examples
//Updated for Swift 4
//One Button
class ViewController: UIViewController {
@IBAction func showAlertButtonTapped(_ sender: UIButton) {
// create the alert
let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: UIAlertControllerStyle.alert)
@elenamene
elenamene / UIAlertController+TextField.swift
Created June 1, 2019 15:37 — forked from ole/UIAlertController+TextField.swift
A UIAlertController with a text field and the ability to perform validation on the text the user has entered while the alert is on screen. The OK button is only enabled when the entered text passes validation. More info: 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)
@elenamene
elenamene / .gitignore
Last active January 30, 2021 11:20
.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
@elenamene
elenamene / swiftlint.yml
Last active February 20, 2021 20:45
swiftlint.yml
disabled_rules: # rule identifiers to exclude from running
- identifier_name
opt_in_rules: # some rules are only opt-in
- anyobject_protocol
- toggle_bool
- operator_usage_whitespace
- overridden_super_call
- prohibited_super_call
- array_init