Reputation: 31
I am trying to pass the cell name to next view (detailView) but always get this error "fatal error: unexpectedly found nil while unwrapping an Optional value"
Upvotes: 0
Views: 73
Reputation: 7171
At the time that prepare(for segue...
is called, your outlets have not been assigned yet. Your view must be loaded before your outlets are assigned. You can force the view to load simply by accessing it (detailView.view
), but this is a bad idea. A better approach would be to assign another property on your view controller with the value you're trying to pass around, then in viewDidLoad
of your detail view controller, set the properties you wish to set on your IBOutlets.
Upvotes: 3