performSegueWithIdentifier very slow when segue is modal

It seems (to me...) that this problem happens only when the cell selectionType is not .none.

You may change it to any other option (at the storyboard Attribute inspector, set the Selection field) and it will work fine (working for me...). The cons is that it messing up the cell UI.

You can call the segue in DispatchQueue.main.async{} block at the didSelect delegate function of UITableViewDelegate as people mention before.

I used the first solution and added at the cell itself -

override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(false, animated: false)
}

This will make the cell 'highlight' at the tap, but it will return to its usual UI immediately and it fine for me...


Trust me and try this. I have run into this problem a few times.

In Swift 2:

dispatch_async(dispatch_get_main_queue(),{
    self.performSegue(withIdentifier:mysegueIdentifier,sender: self)
})

or for Swift 3:

DispatchQueue.main.async {
    self.performSegue(withIdentifier: mysegueIdentifier,sender: self)
}

As discussed here and here.