iOS segue freeze for many seconds before showing new view
I checked your project. And while I also couldn't find anything else, I also suspect that it's a problem with threading.
I managed to fix the problem by implementing a delegate for the tableview
and present the new controller in code:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let destination = storyboard?.instantiateViewControllerWithIdentifier("BuilderToysListViewController") as! BuilderToysListViewController
destination.botsRepository = botsRepository!
destination.builder = builders[builderIds[indexPath.row]]
dispatch_async(dispatch_get_main_queue(), { () -> Void in
self.presentViewController(destination, animated: true) { () -> Void in
}
})
}
Notice you have the set the view controller storyboard id: BuilderToysListViewController
and also set the tableview delegate. Don't forget to remove the segues.
At the end to dissmis the view in the new view controller use this code:
@IBAction func backButton(sender: AnyObject)
{
dismissViewControllerAnimated(true, completion: { () -> Void in
})
// performSegueWithIdentifier("segueToysByBuilder", sender: nil)
}
This would allow you to properly close the view instead of wrongly creating a new one.