52inc / Pulley

A library to imitate the iOS 10 Maps UI.
https://cocoapods.org/pods/Pulley
MIT License
2.02k stars 265 forks source link

Trying to instantiateViewController to open the pulley view controller #426

Closed keegho closed 1 year ago

keegho commented 1 year ago

When I try to instantiateViewController in another storyboard that is in a navigation controller the view cannot be presented and I get this error. What am I doing wrong here? Seems like there is something I'm missing here.

Application tried to present modally a view controller <CategoryViewController: 0x10c819890> that has a parent view controller <Pulley.PulleyViewController: 0x10d832a00>.

private func toEditViewController() {

        let storyboard = UIStoryboard(name: "Recycling", bundle: nil)
        let navVC = storyboard.instantiateViewController(withIdentifier: "requestnavcontroller") as! RequestNavigationController
        let pulley = navVC.viewControllers[0] as! PulleyViewController
        pulley.loadViewIfNeeded()
        let vc = pulley.primaryContentViewController as! CategoryViewController
        vc.isFromEditing = true
        present(vc, animated: true)

 }