Can't cast value of type UIViewController to PatternDetailViewController

前端 未结 8 1631
孤街浪徒
孤街浪徒 2020-12-06 04:29

Am trying to downcast a view controller to a detail view controller but can\'t. Am using Core Data (for the first time). The error is in the prepareForSegue method and reads

8条回答
  •  孤城傲影
    2020-12-06 04:41

    My issue is:

    Not work

    let aBCViewController = UIViewController(nibName: "ABCViewController", bundle: nil) as! ABCViewController
    present(aBCViewController, animated: true, completion: nil)
    

    Work

    let aBCViewController = ABCViewController(nibName: "ABCViewController", bundle: nil)
    present(aBCViewController, animated: true, completion: nil)
    

提交回复
热议问题