2

I have been looking for an answer for this for a while now, but have not yet found any. I have a method that looks like this

dispatch_async(dispatch_get_main_queue()) {
    self.performSegueWithIdentifier("ShowNextView", sender: nil)
}

Is it possible in some way to use the performSelectorOnMainThread for this purpose? As I can see performSelectorOnMainThread on accepts one parameter.

  • Does this answer your question ... http://stackoverflow.com/questions/9335434/whats-the-difference-between-performselectoronmainthread-and-dispatch-async-on-m – Michael Jan 22 '16 at 00:40
  • Why on earth would you want to use performSelectorOnMainThread? – gnasher729 Jan 22 '16 at 09:09

2 Answers2

0

Have you tried to set the sender to self instead of nil?

dispatch_async(dispatch_get_main_queue(),{
    self.performSegueWithIdentifier("ShowNextView",sender: self)
})
Jesús Hurtado
  • 295
  • 2
  • 12
0

did you try this?

   let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
            dispatch_async(dispatch_get_global_queue(priority, 0)) {
                dispatch_async(dispatch_get_main_queue()) {
                        self.performSegueWithIdentifier("ShowNextView", sender: nil)
                }
            }
yildirimosman
  • 133
  • 2
  • 5