Skip to content

Instantly share code, notes, and snippets.

@macneko-ayu
macneko-ayu / UIAlertControllerExtension.swift
Last active July 5, 2021 10:36
Sample calling a delegate method like UIAlertView when UIAlertController's UIAlertAction is executed. Available with Swift and Objective-C.
import UIKit
@objc protocol AlertControllerDelegate: class {
func alertController(_ alert: UIAlertController, tappedIndex: Int) -> Void
}
private var DelegateKey: UInt8 = 0
private var TagKey: UInt8 = 0
extension UIAlertController {