For some strange reason, Xcode
doesn't recognize my segue when I create it and use performSegueWithIdentifier("Details", sender: self)
.
But I was able to find a way around this by presenting the view controller with this:
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("DetailsViewController") as! UIViewController
self.presentViewController(viewController, animated: true, completion: nil)
How can I pass data from the MKAnnotationView
, to the new details view if I'm not using a segue
? (func prepareForSegue
requires a segue to pass data right?)
// You have to make object of that DetailViewController(Class Name)
rather than viewController
let viewController:UIViewController = storyboard.instantiateViewControllerWithIdentifier("DetailsViewController") as! DetailViewController
// Then you can access variable of DetailsViewController
Like This:
viewController.parameter = whatever
self.presentViewController(viewController, animated: true, completion: nil)