What I'm trying to do:
I am trying to press a + button on the top right side of the navigation bar, push the app to a new view (using navigationController.pushViewController), get some user input text from the new view, then return back to the original view.
Problem:
Below code returns nil, which causes the navigationController.pushViewController to crash the app. So again, I do
let newPostView = self.storyboard?.instantiateViewController(withIdentifier: "PostNewActivityViewController") as? PostNewActivityViewController
then the line below crashes the app, because the newPostView is nil.
navigationController?.pushViewController(newPostView!, animated: true)
And all the error message I get from this exception is EXC_BAD_INSTRUCTION and the console output is only telling me that it unexpectedly found nil while unwrapping an Optional value. I don't understand why newPostView is nil.
Also, I am wondering if this is the best practice to obtain user input from another view controller.
Any help or feedback will be much appreciated.