DispatchQueue.main.async {
}
This cause error in my Extension
How I use it
let topController = UIApplication.shared.topMostViewController()
DispatchQueue.main.async {
}
This cause error in my Extension
How I use it
let topController = UIApplication.shared.topMostViewController()
You can try to like below
DispatchQueue.main.async {
let topController = UIApplication.shared.topMostViewController()
}
or alternatively you can use block. You can’t return directly from async operation.
func topMostViewController(onSuccess: (UIViewController) -> ()) {
...
}