1

Update(3)

I have the following code:

This works if I wait in the debugger:

And if I dont:

A view can only be associated with at most one view controller at a time!

@IBAction func openTestViewController(_ sender: Any) {
    let b = Bundle(identifier: "com.test")
    let m = MultipleListViewController(nibName: "MultipleListViewController", bundle: b)
    self.present(m, animated: true, completion: nil)
}

This does not work; error: `

A view can only be associated with at most one view controller at a time!

@IBAction func openTestViewController(_ sender: Any) {
    DispatchQueue.main.async {
    let b = Bundle(identifier: "com.test")
    let m = MultipleListViewController(nibName: "MultipleListViewController", bundle: b)
    self.present(m, animated: true, completion: nil)
        }
}

Note: The reason I do Bundle(identifier: "com.test") is because I have it in a framework.

This only works if: 1. I set a breakpoint 2. And wait for it to load - and make sure that I can see it with the little preview eye when debugging.

How can I/should i wait for it in code?

Chris G.
  • 23,930
  • 48
  • 177
  • 302

0 Answers0