Could not cast value of type 'UINavigationController'

后端 未结 3 908
无人及你
无人及你 2021-02-01 06:45

I am implementing a search interface for my application, so basically I will pass the search keyword from one ViewController to another ViewController.

I have done this

3条回答
  •  情话喂你
    2021-02-01 07:23

    Answering my own question. In this case we need to access the child view by doing something like this:

    let nav = segue?.destinationViewController as! UINavigationController
    let svc = nav.topViewController as! SearchViewController
    svc.toPassSearchKeyword = searchKeyword;
    

提交回复
热议问题