Since updating to Tahoe and Xcode 26 I have found that the UISplitViewController.showDetailViewController() is not working in the iPhone version of my app (it is a universal app). I'm just trying to show a detail view after a tap on a UITableView item. The iPad versions are all working correctly. Has anyone else experienced this or have any advice about what may have changed? Thanks in advance.
UISplitViewController.showDetailViewController() not working in iPhone version.
I thought I should supply a code sample to make my question more clear. I misspoke earlier, I'm showing the detail view from a UICollectionView. My detailVC just displays a piece of sheet music as a PDF. Any help would be appreciated.
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let tuneID = self.dataSource.itemIdentifier(for: indexPath),
let tune = try? self.dataController.mainContext?.existingObject(with: tuneID) as? Tune
else { return }
collectionView.deselectItem(at: indexPath, animated: true)
guard let detailNC = TuneDetailVC.tuneDetailViewController(dataController: dataController),
let detailVC = detailNC.topViewController as? TuneDetailVC
else { return }
detailVC.tune = tune
splitViewController?.showDetailViewController(detailNC, sender: self)
if splitViewController?.displayMode == .twoBesideSecondary {
// Note: This should only occur in landscape on iPad.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { [weak self] in
// Use 'hide' instead of settint 'preferredDisplayMode' for a smoother transition.
self?.splitViewController?.hide(.primary)
}
}
}