How to check if another view controller is visible?

Sometimes my application crashes when two UIAlertViewstry to be presented at the same time. How to check if another is displayed UIAlertviewbefore showing another?

Here is what I tried, but it does not work.

Note. I am using quick for this project.

if ViewController.isVisable == false {    
    self.presentViewController(AlertView, animated: true, completion: nil)    
}
+4
source share
2 answers

As a strict answer to your question, you can check if a window has ViewControllerits window:

if ViewController.view.window != nil {

}

In any case, I recommend you take @Wain's advice.

+13
source

. , , , , /, / . , , , ( , ).

, , , , (, , /).

+5

All Articles