I am going to create my application without storyboard.Can you please tell me how can i Call Segue Without
Storyboard Programmatically in Swift? I have searched a lot but not find a good answer of it.
How to Call Segue Without using Storyboards in Swift?
Segue are supposed to be used to transition between view controller placed in Storyboard
If you are not using Storyboard, then use
presentViewController
thnks yatish for ur support but i have created view controller programmetically then how can i go to another view controller using segue? Also that segue obivously programatically how to create it?
Based on the third answer here on the SO forums (spaces inserted so post doesn't end up in moderation):
http : //stackoverflow.com/questions/9674685/creating-a-segue-programmatically
You will have to subclass UIStoryboardSegue and override perform() in the subclass. Then you can create segues from this subclass, and call prepareForSegue(...) and perform().
By definition a segue can't really exist independently of a storyboard. It's even there in the name of the class:
UIStoryboardSegue. You don't create segues programmatically - it is the storyboard runtime that creates them for you. You can normally call performSegueWithIdentifier: in your view controller's code, but this relies on having a segue already set up in the storyboard to reference.Coming to your requirement - I'm not convinced why your purpose of calling a view controller by segue, when you can do the below:
[self presentViewController:yourNewController animated:YES completion:nil]
But yatish if i want to send data to next controller then how can we do that using [self presentViewController...........
Very, very easily. You must have a reference to the controller you want to present, so you can use that reference to call methods or set properties on the new controller.