mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
bff35fda61
* build: Swiftlint plugin * build: Swiftformat plugin * build: Swiftformat plugin * build: Swiftformat bash command * style: Swiftformat rules * style: Swiftformat applied to codebase * style: Ignore Tests for Swiftlint * Update bundler * Update changelog and migration guide * style: Ignore Example for Swiftlint * chore: Changelog * Update Xcode version for ci_pr_tests.yml * Update ci_pr_framework.yml * Update ci_pr_example.yml * chore: Changelog Co-authored-by: Jakub Kaspar <kaspikk@gmail.com>
28 lines
714 B
Swift
28 lines
714 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)
|
|
}
|
|
}
|