Bubble Foundry


by Peter.

This is a category which adds methods on UIViewController to provide a handler at the spot that you programmatically perform a segue. This avoids a mess of if, else if, else statements in prepareForSegue:sender:. In fact, you don’t even need to implement the method at all if you don’t need do anything before the segues called from actions in your storyboard.

Here’s how you use it:

NSNumber *blogPostID = @1;
[self performSegueWithIdentifier:@"BlogPost" handler:^(BlogPostVC *blogPostVC) {
    blogPostVC.blogPostID = blogPostID;

for the implementation.