protocol HasWaitAnimation: UIViewController {
var alertWait: ActivityViewController? {get set}
}
extension HasWaitAnimation where Self: UIViewController {
func showAlertWait(message: String, completion: @escaping()->Void) {
DispatchQueue.main.async {
let activitiyViewController = ActivityViewController(message: message)
self.present(activitiyViewController, animated: false, completion: {
completion()
})
self.alertWait = activitiyViewController
}
}
func hideAlertWait (completion: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now()+0.2, execute: {
self.alertWait?.dismiss(animated: true, completion: completion)
self.alertWait = nil
})
}
}
On Xcode 13 I get
"Redundant superclass constraint 'Self' : 'UIViewController'"
at line
"extension HasWaitAnimation where Self: UIViewController {"
How can I solve this?