AlertController
UIAlertController’s subclass replacement! ?
Setup
Add the following to Package.swift
:
.package(url: "https://github.com/stateman92/AlertController", exact: .init(0, 0, 1))
Usage
import UIKit
import AlertController
final class CustomAlertController: AlertController {
override init() {
super.init()
set(alertController: getAlertController())
}
private func getAlertController() -> UIAlertController {
let alertController = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alertController.addAction(.init(title: "Close", style: .cancel, handler: { [weak self] _ in
self?.close()
}))
return alertController
}
}
// ...
CustomAlertController().show(on: self) // where self is a UIViewController
For details see the Example app.