RamblerSegues
RamblerSegues copied to clipboard
Embed segue and Cross Storyboard segues library.
Overview
RamblerSegues is a collection of custom UIStoryboardSegue subclasses useful in different everyday situations.
Key features
-
EmbedSegue - present child
UIViewController
s as easy as it should be. -
CrossStoryboardSegue - if you're afraid of linked
UIStoryboard
s - this segue is your perfect choice.
Usage
EmbedSegue
- Add a
UIView
on your parentUIViewController
- this view will suit as a container for a child module. Connect it toIBOutlet
with nameembedSegueContainer
. - Add a segue with class
RamblerEmbedSegue
from parentUIViewController
to childUIViewController
. Set its identifier toEmbedSegueExample
.
- Implement a method
- (UIView*)viewForEmbedIdentifier:(NSString*)embedIdentifier
in parentUIViewController
and returnembedSegueContainer
in it:
- (UIView*)viewForEmbedIdentifier:(NSString*)embedIdentifier {
if ([embedIdentifier isEqualToString:@"EmbedSegueExample"]) {
return self.embedSegueContainer;
}
return nil;
}
- Enjoy - now you can manage child view controller transitions just like any other - even from
Router
using ViperMcFlurry.
CrossStoryboardSegue
- Add a new empty
UIViewController
on the first storyboard. Set its class toRamblerPlaceholderViewController
and restoration identifier toSecondViewController@AnotherStoryboard
.
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]