Files
MessageKit/Example/Sources/Extensions/AlertService.swift
T
Mohannad Bakbouk 6b6532f79f mofifications
2021-04-02 14:49:22 +03:00

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)
}
}