Ok, I have looked at performSegueWithIdentifier very slow when segue is modal and tried similar solutions but i am still having a problem - Im working in Swift
, and performing a segue based on a tap from a list VC cell takes a good 5-30 seconds. It just hangs there with the bar selected.
I tried speeding this up with
DispatchQueue.main.async {
self.performSegue(withIdentifier: "toPodcastPlayer", sender: self)
}
However all this did was not make the bar select in a color. I need to display a loading screen if this is going to occur, but when with this func for loading:
let loadView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
loadView.backgroundColor = UIColor.green
loadView.center = CGPoint(x: screenSize.width/2, y: screenSize.height/2)
view.addSubview(loadView)
And this when tapped:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let selectedIndexPath : [IndexPath] = self.myTableView.indexPathsForSelectedRows!
if(self.rssListToLoad[selectedIndexPath[0].row].link != "")
{
showLoading()
self.performSegue(withIdentifier: "toPodcastPlayer", sender: self)
}
and
if segue.identifier == "toPodcastPlayer" {
// find index path for selected row
let selectedIndexPath : [IndexPath] = self.myTableView.indexPathsForSelectedRows!
// deselect the selected row
self.myTableView.deselectRow(at: selectedIndexPath[0], animated: true)
// create destination view controller
let destVc = segue.destination as! PodcastViewController
// set title for next screen
destVc.adTxtName = "Skylar's Ad"
destVc.urlStr = self.rssRecordList[selectedIndexPath[0].row].link
destVc.trackLabel = self.rssRecordList[selectedIndexPath[0].row].title
It is still delayed. I don't understand this since the view is already created in the storyboard
and just has to set some variables in the next VC. What is wrong here?
My segue type is a present modally, not deprecated.