I\'m trying to have the app go to a different view controller after the user chooses a photo from the picker.
func imagePickerController(_ picker: UIImagePickerC
The primary cause of your issue is that you are trying to access the outlets of the view controller too soon. The view controller's views and outlets are not created and assigned immediately after instantiating the view controller.
It's also poor design to attempt to directly access the views of a view controller from code outside of that view controller. The proper solution, in this case, is to add a UIImage
property that you can set. Then let the view controller update its own image view based on the value of that image property at the proper time (such as in viewDidLoad
).