From a non-view controller class I want to pop up to the ui a custom like- toast message.
I want it to appear for 2 seconds.
I know I need to use dispatch_async
twice.
One for unhiding the message
Second for hiding the message after 2 seconds. This requires dispatch_after()
?
How do I call the main view-controller from a different class? calling self.showError()
will not work, because self is not the main view-controller.
I have tried this:
dispatch_async(dispatch_get_main_queue()) {
self.showError()
}
dispatch_async(dispatch_get_main_queue(), ??? 2 seconds) {
self.hideError()
}