GBA-8-19/CGame/Extensions/UIAlertController+Error.swift
bluesea 66c5202be8 s
2024-06-14 18:12:40 +08:00

33 lines
650 B
Swift

//
// UIAlertController+Error.swift
// INLINE
//
// Created by Hthik on 11/27/18.
// Copyright © 2018 Hthik. All rights reserved.
//
import Foundation
import Roxas
import Harmony
extension UIAlertController
{
convenience init(title: String, error: Error)
{
let message: String
if let error = error as? HarmonyError, let reason = error.failureReason
{
message = reason
}
else
{
message = error.localizedDescription
}
self.init(title: title, message: message, preferredStyle: .alert)
self.addAction(.ok)
}
}