wireguard-apple/Sources/WireGuardApp/UI/iOS/ErrorPresenter.swift
Andrej Mihajlov ec57408570 Move all source files to Sources/ and rename WireGuardKit targets
Signed-off-by: Andrej Mihajlov <and@mullvad.net>
2020-12-03 13:32:24 +01:00

20 lines
715 B
Swift

// SPDX-License-Identifier: MIT
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import UIKit
import os.log
class ErrorPresenter: ErrorPresenterProtocol {
static func showErrorAlert(title: String, message: String, from sourceVC: AnyObject?, onPresented: (() -> Void)?, onDismissal: (() -> Void)?) {
guard let sourceVC = sourceVC as? UIViewController else { return }
let okAction = UIAlertAction(title: "OK", style: .default) { _ in
onDismissal?()
}
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
alert.addAction(okAction)
sourceVC.present(alert, animated: true, completion: onPresented)
}
}