mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
29 lines
744 B
Swift
29 lines
744 B
Swift
//
|
|
// AlertService.swift
|
|
// ChatExample
|
|
//
|
|
// Created by Mohannad on 12/25/20.
|
|
// Copyright © 2020 MessageKit. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
|
|
class AlertService {
|
|
|
|
|
|
static func showAlert(style: UIAlertController.Style, title: String?, message: String?, actions: [UIAlertAction] = [UIAlertAction(title: "Ok", style: .cancel, handler: nil)], completion: (() -> Swift.Void)? = nil) {
|
|
let alert = UIAlertController(title: title, message: message, preferredStyle: style)
|
|
for action in actions {
|
|
alert.addAction(action)
|
|
}
|
|
|
|
UIApplication.shared.delegate?.window??.rootViewController?.present(alert, animated: true, completion: completion)
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|