Skip to content

rambler-digital-solutions/RamblerSegues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Version License Platform

RamblerSegues is a collection of custom UIStoryboardSegue subclasses useful in different everyday situations.

Segues

Key features

  • EmbedSegue - present child UIViewControllers as easy as it should be.
  • CrossStoryboardSegue - if you're afraid of linked UIStoryboards - this segue is your perfect choice.

Usage

EmbedSegue

  1. Add a UIView on your parent UIViewController - this view will suit as a container for a child module. Connect it to IBOutlet with name embedSegueContainer.
  2. Add a segue with class RamblerEmbedSegue from parent UIViewController to child UIViewController. Set its identifier to EmbedSegueExample.

UIStoryboard

  1. Implement a method - (UIView*)viewForEmbedIdentifier:(NSString*)embedIdentifier in parent UIViewController and return embedSegueContainer in it:
- (UIView*)viewForEmbedIdentifier:(NSString*)embedIdentifier {
  if ([embedIdentifier isEqualToString:@"EmbedSegueExample"]) {
      return self.embedSegueContainer;
  }
  return nil;
}
  1. Enjoy - now you can manage child view controller transitions just like any other - even from Router using ViperMcFlurry.

CrossStoryboardSegue

  1. Add a new empty UIViewController on the first storyboard. Set its class to RamblerPlaceholderViewController and restoration identifier to SecondViewController@AnotherStoryboard.

Placeholder UIViewController 2. Add a segue with class CrossStoryboardSegueExample and identifier CrossStoryboardSegueExample from parent UIViewController to this placeholder. 3. Add your target view controller to second storyboard - AnotherStoryboard. Set its Storyboard ID to SecondViewController. 4. Enjoy once again - you can use this segue just as usual one, but instead it will open UIViewController from another storyboard:

[self performSegueWithIdentifier:@"CrossStoryboardSegueExample" sender:self];

You can test both segues in the example project - clone the repo, and run pod install from the Example directory first.

Installation

RamblerSegues is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "RamblerSegues"

License

RamblerSegues is available under the MIT license. See the LICENSE file for more info.

Author

Andrey Zarembo-Godzyatskiy, [email protected]