diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.h b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.h new file mode 100755 index 00000000..0bc9c993 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.h @@ -0,0 +1,47 @@ +// +// RECommonFunctions.h +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import + + +#ifndef REUIKitIsFlatMode +#define REUIKitIsFlatMode() RESideMenuUIKitIsFlatMode() +#endif + +#ifndef kCFCoreFoundationVersionNumber_iOS_6_1 +#define kCFCoreFoundationVersionNumber_iOS_6_1 793.00 +#endif + +#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1 +#define IF_IOS7_OR_GREATER(...) \ +if (kCFCoreFoundationVersionNumber > kCFCoreFoundationVersionNumber_iOS_6_1) \ +{ \ +__VA_ARGS__ \ +} +#else +#define IF_IOS7_OR_GREATER(...) +#endif + +BOOL RESideMenuUIKitIsFlatMode(void); \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.m b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.m new file mode 100755 index 00000000..6924d662 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RECommonFunctions.m @@ -0,0 +1,45 @@ +// +// RECommonFunctions.m +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import "RECommonFunctions.h" +#import + +BOOL RESideMenuUIKitIsFlatMode(void) +{ + static BOOL isUIKitFlatMode = NO; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + if (floor(NSFoundationVersionNumber) > 993.0) { + // If your app is running in legacy mode, tintColor will be nil - else it must be set to some color. + if (UIApplication.sharedApplication.keyWindow) { + isUIKitFlatMode = [UIApplication.sharedApplication.delegate.window performSelector:@selector(tintColor)] != nil; + } else { + // Possible that we're called early on (e.g. when used in a Storyboard). Adapt and use a temporary window. + isUIKitFlatMode = [[UIWindow new] performSelector:@selector(tintColor)] != nil; + } + } + }); + return isUIKitFlatMode; +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.h b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.h new file mode 100755 index 00000000..6682ae1b --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.h @@ -0,0 +1,96 @@ +// +// REFrostedViewController.h +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import +#import "UIViewController+RESideMenu.h" + +#ifndef IBInspectable +#define IBInspectable +#endif + +@protocol RESideMenuDelegate; + +@interface RESideMenu : UIViewController + +#if __IPHONE_8_0 +@property (strong, readwrite, nonatomic) IBInspectable NSString *contentViewStoryboardID; +@property (strong, readwrite, nonatomic) IBInspectable NSString *leftMenuViewStoryboardID; +@property (strong, readwrite, nonatomic) IBInspectable NSString *rightMenuViewStoryboardID; +#endif + +@property (strong, readwrite, nonatomic) UIViewController *contentViewController; +@property (strong, readwrite, nonatomic) UIViewController *leftMenuViewController; +@property (strong, readwrite, nonatomic) UIViewController *rightMenuViewController; +@property (weak, readwrite, nonatomic) id delegate; + +@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration; +@property (strong, readwrite, nonatomic) UIImage *backgroundImage; +@property (assign, readwrite, nonatomic) BOOL panGestureEnabled; +@property (assign, readwrite, nonatomic) BOOL panFromEdge; +@property (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold; +@property (assign, readwrite, nonatomic) IBInspectable BOOL interactivePopGestureRecognizerEnabled; +@property (assign, readwrite, nonatomic) IBInspectable BOOL fadeMenuView; +@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleContentView; +@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleBackgroundImageView; +@property (assign, readwrite, nonatomic) IBInspectable BOOL scaleMenuView; +@property (assign, readwrite, nonatomic) IBInspectable BOOL contentViewShadowEnabled; +@property (strong, readwrite, nonatomic) IBInspectable UIColor *contentViewShadowColor; +@property (assign, readwrite, nonatomic) IBInspectable CGSize contentViewShadowOffset; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewShadowOpacity; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewShadowRadius; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewFadeOutAlpha; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewScaleValue; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewInLandscapeOffsetCenterX; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat contentViewInPortraitOffsetCenterX; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMinimumRelativeValue; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMaximumRelativeValue; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMinimumRelativeValue; +@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMaximumRelativeValue; +@property (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation; +@property (assign, readwrite, nonatomic) IBInspectable BOOL parallaxEnabled; +@property (assign, readwrite, nonatomic) IBInspectable BOOL bouncesHorizontally; +@property (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle; +@property (assign, readwrite, nonatomic) IBInspectable BOOL menuPrefersStatusBarHidden; + +- (id)initWithContentViewController:(UIViewController *)contentViewController + leftMenuViewController:(UIViewController *)leftMenuViewController + rightMenuViewController:(UIViewController *)rightMenuViewController; +- (void)presentLeftMenuViewController; +- (void)presentRightMenuViewController; +- (void)hideMenuViewController; +- (void)setContentViewController:(UIViewController *)contentViewController animated:(BOOL)animated; + +@end + +@protocol RESideMenuDelegate + +@optional +- (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer; +- (void)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController; +- (void)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController; +- (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController; +- (void)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController; + +@end diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.m b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.m new file mode 100755 index 00000000..b6b8efd9 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/RESideMenu.m @@ -0,0 +1,860 @@ +// +// REFrostedViewController.m +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import "RESideMenu.h" +#import "UIViewController+RESideMenu.h" +#import "RECommonFunctions.h" + +@interface RESideMenu () + +@property (strong, readwrite, nonatomic) UIImageView *backgroundImageView; +@property (assign, readwrite, nonatomic) BOOL visible; +@property (assign, readwrite, nonatomic) BOOL leftMenuVisible; +@property (assign, readwrite, nonatomic) BOOL rightMenuVisible; +@property (assign, readwrite, nonatomic) CGPoint originalPoint; +@property (strong, readwrite, nonatomic) UIButton *contentButton; +@property (strong, readwrite, nonatomic) UIView *menuViewContainer; +@property (strong, readwrite, nonatomic) UIView *contentViewContainer; +@property (assign, readwrite, nonatomic) BOOL didNotifyDelegate; + +@end + +@implementation RESideMenu + +#pragma mark - +#pragma mark Instance lifecycle + +- (id)init +{ + self = [super init]; + if (self) { + [self commonInit]; + } + return self; +} + +- (id)initWithCoder:(NSCoder *)decoder +{ + self = [super initWithCoder:decoder]; + if (self) { + [self commonInit]; + } + return self; +} + +#if __IPHONE_8_0 +- (void)awakeFromNib +{ + if (self.contentViewStoryboardID) { + self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:self.contentViewStoryboardID]; + } + if (self.leftMenuViewStoryboardID) { + self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:self.leftMenuViewStoryboardID]; + } + if (self.rightMenuViewStoryboardID) { + self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:self.rightMenuViewStoryboardID]; + } +} +#endif + +- (void)commonInit +{ + _menuViewContainer = [[UIView alloc] init]; + _contentViewContainer = [[UIView alloc] init]; + + _animationDuration = 0.35f; + _interactivePopGestureRecognizerEnabled = YES; + + _menuViewControllerTransformation = CGAffineTransformMakeScale(1.5f, 1.5f); + + _scaleContentView = YES; + _scaleBackgroundImageView = YES; + _scaleMenuView = YES; + _fadeMenuView = YES; + + _parallaxEnabled = YES; + _parallaxMenuMinimumRelativeValue = -15; + _parallaxMenuMaximumRelativeValue = 15; + _parallaxContentMinimumRelativeValue = -25; + _parallaxContentMaximumRelativeValue = 25; + + _bouncesHorizontally = YES; + + _panGestureEnabled = YES; + _panFromEdge = YES; + _panMinimumOpenThreshold = 60.0; + + _contentViewShadowEnabled = NO; + _contentViewShadowColor = [UIColor blackColor]; + _contentViewShadowOffset = CGSizeZero; + _contentViewShadowOpacity = 0.4f; + _contentViewShadowRadius = 8.0f; + _contentViewFadeOutAlpha = 1.0f; + _contentViewInLandscapeOffsetCenterX = 30.f; + _contentViewInPortraitOffsetCenterX = 30.f; + _contentViewScaleValue = 0.7f; +} + +#pragma mark - +#pragma mark Public methods + +- (id)initWithContentViewController:(UIViewController *)contentViewController leftMenuViewController:(UIViewController *)leftMenuViewController rightMenuViewController:(UIViewController *)rightMenuViewController +{ + self = [self init]; + if (self) { + _contentViewController = contentViewController; + _leftMenuViewController = leftMenuViewController; + _rightMenuViewController = rightMenuViewController; + } + return self; +} + +- (void)presentLeftMenuViewController +{ + [self presentMenuViewContainerWithMenuViewController:self.leftMenuViewController]; + [self showLeftMenuViewController]; +} + +- (void)presentRightMenuViewController +{ + [self presentMenuViewContainerWithMenuViewController:self.rightMenuViewController]; + [self showRightMenuViewController]; +} + +- (void)hideMenuViewController +{ + [self hideMenuViewControllerAnimated:YES]; +} + +- (void)setContentViewController:(UIViewController *)contentViewController animated:(BOOL)animated +{ + if (_contentViewController == contentViewController) + { + return; + } + + if (!animated) { + [self setContentViewController:contentViewController]; + } else { + [self addChildViewController:contentViewController]; + contentViewController.view.alpha = 0; + contentViewController.view.frame = self.contentViewContainer.bounds; + [self.contentViewContainer addSubview:contentViewController.view]; + [UIView animateWithDuration:self.animationDuration animations:^{ + contentViewController.view.alpha = 1; + } completion:^(BOOL finished) { + [self hideViewController:self.contentViewController]; + [contentViewController didMoveToParentViewController:self]; + _contentViewController = contentViewController; + + [self statusBarNeedsAppearanceUpdate]; + [self updateContentViewShadow]; + + if (self.visible) { + [self addContentViewControllerMotionEffects]; + } + }]; + } +} + +#pragma mark View life cycle + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + self.backgroundImageView = ({ + UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.view.bounds]; + imageView.image = self.backgroundImage; + imageView.contentMode = UIViewContentModeScaleAspectFill; + imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + imageView; + }); + self.contentButton = ({ + UIButton *button = [[UIButton alloc] initWithFrame:CGRectNull]; + [button addTarget:self action:@selector(hideMenuViewController) forControlEvents:UIControlEventTouchUpInside]; + button; + }); + + [self.view addSubview:self.backgroundImageView]; + [self.view addSubview:self.menuViewContainer]; + [self.view addSubview:self.contentViewContainer]; + + self.menuViewContainer.frame = self.view.bounds; + self.menuViewContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + + if (self.leftMenuViewController) { + [self addChildViewController:self.leftMenuViewController]; + self.leftMenuViewController.view.frame = self.view.bounds; + self.leftMenuViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.menuViewContainer addSubview:self.leftMenuViewController.view]; + [self.leftMenuViewController didMoveToParentViewController:self]; + } + + if (self.rightMenuViewController) { + [self addChildViewController:self.rightMenuViewController]; + self.rightMenuViewController.view.frame = self.view.bounds; + self.rightMenuViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.menuViewContainer addSubview:self.rightMenuViewController.view]; + [self.rightMenuViewController didMoveToParentViewController:self]; + } + + self.contentViewContainer.frame = self.view.bounds; + self.contentViewContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + + [self addChildViewController:self.contentViewController]; + self.contentViewController.view.frame = self.view.bounds; + [self.contentViewContainer addSubview:self.contentViewController.view]; + [self.contentViewController didMoveToParentViewController:self]; + + self.menuViewContainer.alpha = !self.fadeMenuView ?: 0; + if (self.scaleBackgroundImageView) + self.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f); + + [self addMenuViewControllerMotionEffects]; + + if (self.panGestureEnabled) { + self.view.multipleTouchEnabled = NO; + UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognized:)]; + panGestureRecognizer.delegate = self; + [self.view addGestureRecognizer:panGestureRecognizer]; + } + + [self updateContentViewShadow]; +} + +#pragma mark - +#pragma mark Private methods + +- (void)presentMenuViewContainerWithMenuViewController:(UIViewController *)menuViewController +{ + self.menuViewContainer.transform = CGAffineTransformIdentity; + if (self.scaleBackgroundImageView) { + self.backgroundImageView.transform = CGAffineTransformIdentity; + self.backgroundImageView.frame = self.view.bounds; + } + self.menuViewContainer.frame = self.view.bounds; + if (self.scaleMenuView) { + self.menuViewContainer.transform = self.menuViewControllerTransformation; + } + self.menuViewContainer.alpha = !self.fadeMenuView ?: 0; + if (self.scaleBackgroundImageView) + self.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f); + + if ([self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:willShowMenuViewController:)]) { + [self.delegate sideMenu:self willShowMenuViewController:menuViewController]; + } +} + +- (void)showLeftMenuViewController +{ + if (!self.leftMenuViewController) { + return; + } + [self.leftMenuViewController beginAppearanceTransition:YES animated:YES]; + self.leftMenuViewController.view.hidden = NO; + self.rightMenuViewController.view.hidden = YES; + [self.view.window endEditing:YES]; + [self addContentButton]; + [self updateContentViewShadow]; + [self resetContentViewScale]; + + [UIView animateWithDuration:self.animationDuration animations:^{ + if (self.scaleContentView) { + self.contentViewContainer.transform = CGAffineTransformMakeScale(self.contentViewScaleValue, self.contentViewScaleValue); + } else { + self.contentViewContainer.transform = CGAffineTransformIdentity; + } + + if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) { + self.contentViewContainer.center = CGPointMake((UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? self.contentViewInLandscapeOffsetCenterX + CGRectGetWidth(self.view.frame) : self.contentViewInPortraitOffsetCenterX + CGRectGetWidth(self.view.frame)), self.contentViewContainer.center.y); + } else { + self.contentViewContainer.center = CGPointMake((UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? self.contentViewInLandscapeOffsetCenterX + CGRectGetHeight(self.view.frame) : self.contentViewInPortraitOffsetCenterX + CGRectGetWidth(self.view.frame)), self.contentViewContainer.center.y); + } + + self.menuViewContainer.alpha = !self.fadeMenuView ?: 1.0f; + self.contentViewContainer.alpha = self.contentViewFadeOutAlpha; + self.menuViewContainer.transform = CGAffineTransformIdentity; + if (self.scaleBackgroundImageView) + self.backgroundImageView.transform = CGAffineTransformIdentity; + + } completion:^(BOOL finished) { + [self addContentViewControllerMotionEffects]; + [self.leftMenuViewController endAppearanceTransition]; + + if (!self.visible && [self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:didShowMenuViewController:)]) { + [self.delegate sideMenu:self didShowMenuViewController:self.leftMenuViewController]; + } + + self.visible = YES; + self.leftMenuVisible = YES; + }]; + + [self statusBarNeedsAppearanceUpdate]; +} + +- (void)showRightMenuViewController +{ + if (!self.rightMenuViewController) { + return; + } + [self.rightMenuViewController beginAppearanceTransition:YES animated:YES]; + self.leftMenuViewController.view.hidden = YES; + self.rightMenuViewController.view.hidden = NO; + [self.view.window endEditing:YES]; + [self addContentButton]; + [self updateContentViewShadow]; + [self resetContentViewScale]; + + [[UIApplication sharedApplication] beginIgnoringInteractionEvents]; + [UIView animateWithDuration:self.animationDuration animations:^{ + if (self.scaleContentView) { + self.contentViewContainer.transform = CGAffineTransformMakeScale(self.contentViewScaleValue, self.contentViewScaleValue); + } else { + self.contentViewContainer.transform = CGAffineTransformIdentity; + } + self.contentViewContainer.center = CGPointMake((UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? -self.contentViewInLandscapeOffsetCenterX : -self.contentViewInPortraitOffsetCenterX), self.contentViewContainer.center.y); + + self.menuViewContainer.alpha = !self.fadeMenuView ?: 1.0f; + self.contentViewContainer.alpha = self.contentViewFadeOutAlpha; + self.menuViewContainer.transform = CGAffineTransformIdentity; + if (self.scaleBackgroundImageView) + self.backgroundImageView.transform = CGAffineTransformIdentity; + + } completion:^(BOOL finished) { + [self.rightMenuViewController endAppearanceTransition]; + if (!self.rightMenuVisible && [self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:didShowMenuViewController:)]) { + [self.delegate sideMenu:self didShowMenuViewController:self.rightMenuViewController]; + } + + self.visible = !(self.contentViewContainer.frame.size.width == self.view.bounds.size.width && self.contentViewContainer.frame.size.height == self.view.bounds.size.height && self.contentViewContainer.frame.origin.x == 0 && self.contentViewContainer.frame.origin.y == 0); + self.rightMenuVisible = self.visible; + [[UIApplication sharedApplication] endIgnoringInteractionEvents]; + [self addContentViewControllerMotionEffects]; + }]; + + [self statusBarNeedsAppearanceUpdate]; +} + +- (void)hideViewController:(UIViewController *)viewController +{ + [viewController willMoveToParentViewController:nil]; + [viewController.view removeFromSuperview]; + [viewController removeFromParentViewController]; +} + +- (void)hideMenuViewControllerAnimated:(BOOL)animated +{ + BOOL rightMenuVisible = self.rightMenuVisible; + UIViewController *visibleMenuViewController = rightMenuVisible ? self.rightMenuViewController : self.leftMenuViewController; + [visibleMenuViewController beginAppearanceTransition:NO animated:animated]; + if ([self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:willHideMenuViewController:)]) { + [self.delegate sideMenu:self willHideMenuViewController:rightMenuVisible ? self.rightMenuViewController : self.leftMenuViewController]; + } + + self.visible = NO; + self.leftMenuVisible = NO; + self.rightMenuVisible = NO; + [self.contentButton removeFromSuperview]; + + __typeof (self) __weak weakSelf = self; + void (^animationBlock)(void) = ^{ + __typeof (weakSelf) __strong strongSelf = weakSelf; + if (!strongSelf) { + return; + } + strongSelf.contentViewContainer.transform = CGAffineTransformIdentity; + strongSelf.contentViewContainer.frame = strongSelf.view.bounds; + if (strongSelf.scaleMenuView) { + strongSelf.menuViewContainer.transform = strongSelf.menuViewControllerTransformation; + } + strongSelf.menuViewContainer.alpha = !self.fadeMenuView ?: 0; + strongSelf.contentViewContainer.alpha = 1; + + if (strongSelf.scaleBackgroundImageView) { + strongSelf.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f); + } + if (strongSelf.parallaxEnabled) { + IF_IOS7_OR_GREATER( + for (UIMotionEffect *effect in strongSelf.contentViewContainer.motionEffects) { + [strongSelf.contentViewContainer removeMotionEffect:effect]; + } + ); + } + }; + void (^completionBlock)(void) = ^{ + __typeof (weakSelf) __strong strongSelf = weakSelf; + if (!strongSelf) { + return; + } + [visibleMenuViewController endAppearanceTransition]; + if (!strongSelf.visible && [strongSelf.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [strongSelf.delegate respondsToSelector:@selector(sideMenu:didHideMenuViewController:)]) { + [strongSelf.delegate sideMenu:strongSelf didHideMenuViewController:rightMenuVisible ? strongSelf.rightMenuViewController : strongSelf.leftMenuViewController]; + } + }; + + if (animated) { + [[UIApplication sharedApplication] beginIgnoringInteractionEvents]; + [UIView animateWithDuration:self.animationDuration animations:^{ + animationBlock(); + } completion:^(BOOL finished) { + [[UIApplication sharedApplication] endIgnoringInteractionEvents]; + completionBlock(); + }]; + } else { + animationBlock(); + completionBlock(); + } + [self statusBarNeedsAppearanceUpdate]; +} + +- (void)addContentButton +{ + if (self.contentButton.superview) + return; + + self.contentButton.autoresizingMask = UIViewAutoresizingNone; + self.contentButton.frame = self.contentViewContainer.bounds; + self.contentButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.contentViewContainer addSubview:self.contentButton]; +} + +- (void)statusBarNeedsAppearanceUpdate +{ + if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { + [UIView animateWithDuration:0.3f animations:^{ + [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; + }]; + } +} + +- (void)updateContentViewShadow +{ + if (self.contentViewShadowEnabled) { + CALayer *layer = self.contentViewContainer.layer; + UIBezierPath *path = [UIBezierPath bezierPathWithRect:layer.bounds]; + layer.shadowPath = path.CGPath; + layer.shadowColor = self.contentViewShadowColor.CGColor; + layer.shadowOffset = self.contentViewShadowOffset; + layer.shadowOpacity = self.contentViewShadowOpacity; + layer.shadowRadius = self.contentViewShadowRadius; + } +} + +- (void)resetContentViewScale +{ + CGAffineTransform t = self.contentViewContainer.transform; + CGFloat scale = sqrt(t.a * t.a + t.c * t.c); + CGRect frame = self.contentViewContainer.frame; + self.contentViewContainer.transform = CGAffineTransformIdentity; + self.contentViewContainer.transform = CGAffineTransformMakeScale(scale, scale); + self.contentViewContainer.frame = frame; +} + +#pragma mark - +#pragma mark iOS 7 Motion Effects (Private) + +- (void)addMenuViewControllerMotionEffects +{ + if (self.parallaxEnabled) { + IF_IOS7_OR_GREATER( + for (UIMotionEffect *effect in self.menuViewContainer.motionEffects) { + [self.menuViewContainer removeMotionEffect:effect]; + } + UIInterpolatingMotionEffect *interpolationHorizontal = [[UIInterpolatingMotionEffect alloc]initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; + interpolationHorizontal.minimumRelativeValue = @(self.parallaxMenuMinimumRelativeValue); + interpolationHorizontal.maximumRelativeValue = @(self.parallaxMenuMaximumRelativeValue); + + UIInterpolatingMotionEffect *interpolationVertical = [[UIInterpolatingMotionEffect alloc]initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; + interpolationVertical.minimumRelativeValue = @(self.parallaxMenuMinimumRelativeValue); + interpolationVertical.maximumRelativeValue = @(self.parallaxMenuMaximumRelativeValue); + + [self.menuViewContainer addMotionEffect:interpolationHorizontal]; + [self.menuViewContainer addMotionEffect:interpolationVertical]; + ); + } +} + +- (void)addContentViewControllerMotionEffects +{ + if (self.parallaxEnabled) { + IF_IOS7_OR_GREATER( + for (UIMotionEffect *effect in self.contentViewContainer.motionEffects) { + [self.contentViewContainer removeMotionEffect:effect]; + } + [UIView animateWithDuration:0.2 animations:^{ + UIInterpolatingMotionEffect *interpolationHorizontal = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; + interpolationHorizontal.minimumRelativeValue = @(self.parallaxContentMinimumRelativeValue); + interpolationHorizontal.maximumRelativeValue = @(self.parallaxContentMaximumRelativeValue); + + UIInterpolatingMotionEffect *interpolationVertical = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; + interpolationVertical.minimumRelativeValue = @(self.parallaxContentMinimumRelativeValue); + interpolationVertical.maximumRelativeValue = @(self.parallaxContentMaximumRelativeValue); + + [self.contentViewContainer addMotionEffect:interpolationHorizontal]; + [self.contentViewContainer addMotionEffect:interpolationVertical]; + }]; + ); + } +} + +#pragma mark - +#pragma mark UIGestureRecognizer Delegate (Private) + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch +{ + IF_IOS7_OR_GREATER( + if (self.interactivePopGestureRecognizerEnabled && [self.contentViewController isKindOfClass:[UINavigationController class]]) { + UINavigationController *navigationController = (UINavigationController *)self.contentViewController; + if (navigationController.viewControllers.count > 1 && navigationController.interactivePopGestureRecognizer.enabled) { + return NO; + } + } + ); + + if (self.panFromEdge && [gestureRecognizer isKindOfClass:[UIPanGestureRecognizer class]] && !self.visible) { + CGPoint point = [touch locationInView:gestureRecognizer.view]; + if (point.x < 20.0 || point.x > self.view.frame.size.width - 20.0) { + return YES; + } else { + return NO; + } + } + + return YES; +} + +#pragma mark - +#pragma mark Pan gesture recognizer (Private) + +- (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer +{ + if ([self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:didRecognizePanGesture:)]) + [self.delegate sideMenu:self didRecognizePanGesture:recognizer]; + + if (!self.panGestureEnabled) { + return; + } + + CGPoint point = [recognizer translationInView:self.view]; + + if (recognizer.state == UIGestureRecognizerStateBegan) { + [self updateContentViewShadow]; + + self.originalPoint = CGPointMake(self.contentViewContainer.center.x - CGRectGetWidth(self.contentViewContainer.bounds) / 2.0, + self.contentViewContainer.center.y - CGRectGetHeight(self.contentViewContainer.bounds) / 2.0); + self.menuViewContainer.transform = CGAffineTransformIdentity; + if (self.scaleBackgroundImageView) { + self.backgroundImageView.transform = CGAffineTransformIdentity; + self.backgroundImageView.frame = self.view.bounds; + } + self.menuViewContainer.frame = self.view.bounds; + [self addContentButton]; + [self.view.window endEditing:YES]; + self.didNotifyDelegate = NO; + } + + if (recognizer.state == UIGestureRecognizerStateChanged) { + CGFloat delta = 0; + if (self.visible) { + delta = self.originalPoint.x != 0 ? (point.x + self.originalPoint.x) / self.originalPoint.x : 0; + } else { + delta = point.x / self.view.frame.size.width; + } + delta = MIN(fabs(delta), 1.6); + + CGFloat contentViewScale = self.scaleContentView ? 1 - ((1 - self.contentViewScaleValue) * delta) : 1; + + CGFloat backgroundViewScale = 1.7f - (0.7f * delta); + CGFloat menuViewScale = 1.5f - (0.5f * delta); + + if (!self.bouncesHorizontally) { + contentViewScale = MAX(contentViewScale, self.contentViewScaleValue); + backgroundViewScale = MAX(backgroundViewScale, 1.0); + menuViewScale = MAX(menuViewScale, 1.0); + } + + self.menuViewContainer.alpha = !self.fadeMenuView ?: delta; + self.contentViewContainer.alpha = 1 - (1 - self.contentViewFadeOutAlpha) * delta; + + if (self.scaleBackgroundImageView) { + self.backgroundImageView.transform = CGAffineTransformMakeScale(backgroundViewScale, backgroundViewScale); + } + + if (self.scaleMenuView) { + self.menuViewContainer.transform = CGAffineTransformMakeScale(menuViewScale, menuViewScale); + } + + if (self.scaleBackgroundImageView) { + if (backgroundViewScale < 1) { + self.backgroundImageView.transform = CGAffineTransformIdentity; + } + } + + if (!self.bouncesHorizontally && self.visible) { + if (self.contentViewContainer.frame.origin.x > self.contentViewContainer.frame.size.width / 2.0) + point.x = MIN(0.0, point.x); + + if (self.contentViewContainer.frame.origin.x < -(self.contentViewContainer.frame.size.width / 2.0)) + point.x = MAX(0.0, point.x); + } + + // Limit size + // + if (point.x < 0) { + point.x = MAX(point.x, -[UIScreen mainScreen].bounds.size.height); + } else { + point.x = MIN(point.x, [UIScreen mainScreen].bounds.size.height); + } + [recognizer setTranslation:point inView:self.view]; + + if (!self.didNotifyDelegate) { + if (point.x > 0) { + if (!self.visible && [self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:willShowMenuViewController:)]) { + [self.delegate sideMenu:self willShowMenuViewController:self.leftMenuViewController]; + } + } + if (point.x < 0) { + if (!self.visible && [self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:willShowMenuViewController:)]) { + [self.delegate sideMenu:self willShowMenuViewController:self.rightMenuViewController]; + } + } + self.didNotifyDelegate = YES; + } + + if (contentViewScale > 1) { + CGFloat oppositeScale = (1 - (contentViewScale - 1)); + self.contentViewContainer.transform = CGAffineTransformMakeScale(oppositeScale, oppositeScale); + self.contentViewContainer.transform = CGAffineTransformTranslate(self.contentViewContainer.transform, point.x, 0); + } else { + self.contentViewContainer.transform = CGAffineTransformMakeScale(contentViewScale, contentViewScale); + self.contentViewContainer.transform = CGAffineTransformTranslate(self.contentViewContainer.transform, point.x, 0); + } + + self.leftMenuViewController.view.hidden = self.contentViewContainer.frame.origin.x < 0; + self.rightMenuViewController.view.hidden = self.contentViewContainer.frame.origin.x > 0; + + if (!self.leftMenuViewController && self.contentViewContainer.frame.origin.x > 0) { + self.contentViewContainer.transform = CGAffineTransformIdentity; + self.contentViewContainer.frame = self.view.bounds; + self.visible = NO; + self.leftMenuVisible = NO; + } else if (!self.rightMenuViewController && self.contentViewContainer.frame.origin.x < 0) { + self.contentViewContainer.transform = CGAffineTransformIdentity; + self.contentViewContainer.frame = self.view.bounds; + self.visible = NO; + self.rightMenuVisible = NO; + } + + [self statusBarNeedsAppearanceUpdate]; + } + + if (recognizer.state == UIGestureRecognizerStateEnded) { + self.didNotifyDelegate = NO; + if (self.panMinimumOpenThreshold > 0 && ( + (self.contentViewContainer.frame.origin.x < 0 && self.contentViewContainer.frame.origin.x > -((NSInteger)self.panMinimumOpenThreshold)) || + (self.contentViewContainer.frame.origin.x > 0 && self.contentViewContainer.frame.origin.x < self.panMinimumOpenThreshold)) + ) { + [self hideMenuViewController]; + } + else if (self.contentViewContainer.frame.origin.x == 0) { + [self hideMenuViewControllerAnimated:NO]; + } + else { + if ([recognizer velocityInView:self.view].x > 0) { + if (self.contentViewContainer.frame.origin.x < 0) { + [self hideMenuViewController]; + } else { + if (self.leftMenuViewController) { + [self showLeftMenuViewController]; + } + } + } else { + if (self.contentViewContainer.frame.origin.x < 20) { + if (self.rightMenuViewController) { + [self showRightMenuViewController]; + } + } else { + [self hideMenuViewController]; + } + } + } + } +} + +#pragma mark - +#pragma mark Setters + +- (void)setBackgroundImage:(UIImage *)backgroundImage +{ + _backgroundImage = backgroundImage; + if (self.backgroundImageView) + self.backgroundImageView.image = backgroundImage; +} + +- (void)setContentViewController:(UIViewController *)contentViewController +{ + if (!_contentViewController) { + _contentViewController = contentViewController; + return; + } + [self hideViewController:_contentViewController]; + _contentViewController = contentViewController; + + [self addChildViewController:self.contentViewController]; + self.contentViewController.view.frame = self.view.bounds; + [self.contentViewContainer addSubview:self.contentViewController.view]; + [self.contentViewController didMoveToParentViewController:self]; + + [self updateContentViewShadow]; + + if (self.visible) { + [self addContentViewControllerMotionEffects]; + } +} + +- (void)setLeftMenuViewController:(UIViewController *)leftMenuViewController +{ + if (!_leftMenuViewController) { + _leftMenuViewController = leftMenuViewController; + return; + } + [self hideViewController:_leftMenuViewController]; + _leftMenuViewController = leftMenuViewController; + + [self addChildViewController:self.leftMenuViewController]; + self.leftMenuViewController.view.frame = self.view.bounds; + self.leftMenuViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.menuViewContainer addSubview:self.leftMenuViewController.view]; + [self.leftMenuViewController didMoveToParentViewController:self]; + + [self addMenuViewControllerMotionEffects]; + [self.view bringSubviewToFront:self.contentViewContainer]; +} + +- (void)setRightMenuViewController:(UIViewController *)rightMenuViewController +{ + if (!_rightMenuViewController) { + _rightMenuViewController = rightMenuViewController; + return; + } + [self hideViewController:_rightMenuViewController]; + _rightMenuViewController = rightMenuViewController; + + [self addChildViewController:self.rightMenuViewController]; + self.rightMenuViewController.view.frame = self.view.bounds; + self.rightMenuViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; + [self.menuViewContainer addSubview:self.rightMenuViewController.view]; + [self.rightMenuViewController didMoveToParentViewController:self]; + + [self addMenuViewControllerMotionEffects]; + [self.view bringSubviewToFront:self.contentViewContainer]; +} + +#pragma mark - +#pragma mark View Controller Rotation handler + +- (BOOL)shouldAutorotate +{ + return self.contentViewController.shouldAutorotate; +} + +- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration +{ + if (self.visible) { + self.menuViewContainer.bounds = self.view.bounds; + self.contentViewContainer.transform = CGAffineTransformIdentity; + self.contentViewContainer.frame = self.view.bounds; + + if (self.scaleContentView) { + self.contentViewContainer.transform = CGAffineTransformMakeScale(self.contentViewScaleValue, self.contentViewScaleValue); + } else { + self.contentViewContainer.transform = CGAffineTransformIdentity; + } + + CGPoint center; + if (self.leftMenuVisible) { + if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1) { + center = CGPointMake((UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? self.contentViewInLandscapeOffsetCenterX + CGRectGetWidth(self.view.frame) : self.contentViewInPortraitOffsetCenterX + CGRectGetWidth(self.view.frame)), self.contentViewContainer.center.y); + } else { + center = CGPointMake((UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? self.contentViewInLandscapeOffsetCenterX + CGRectGetHeight(self.view.frame) : self.contentViewInPortraitOffsetCenterX + CGRectGetWidth(self.view.frame)), self.contentViewContainer.center.y); + } + } else { + center = CGPointMake((UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? -self.contentViewInLandscapeOffsetCenterX : -self.contentViewInPortraitOffsetCenterX), self.contentViewContainer.center.y); + } + + self.contentViewContainer.center = center; + } + + [self updateContentViewShadow]; +} + +#pragma mark - +#pragma mark Status Bar Appearance Management + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + UIStatusBarStyle statusBarStyle = UIStatusBarStyleDefault; + IF_IOS7_OR_GREATER( + statusBarStyle = self.visible ? self.menuPreferredStatusBarStyle : self.contentViewController.preferredStatusBarStyle; + if (self.contentViewContainer.frame.origin.y > 10) { + statusBarStyle = self.menuPreferredStatusBarStyle; + } else { + statusBarStyle = self.contentViewController.preferredStatusBarStyle; + } + ); + return statusBarStyle; +} + +- (BOOL)prefersStatusBarHidden +{ + BOOL statusBarHidden = NO; + IF_IOS7_OR_GREATER( + statusBarHidden = self.visible ? self.menuPrefersStatusBarHidden : self.contentViewController.prefersStatusBarHidden; + if (self.contentViewContainer.frame.origin.y > 10) { + statusBarHidden = self.menuPrefersStatusBarHidden; + } else { + statusBarHidden = self.contentViewController.prefersStatusBarHidden; + } + ); + return statusBarHidden; +} + +- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation +{ + UIStatusBarAnimation statusBarAnimation = UIStatusBarAnimationNone; + IF_IOS7_OR_GREATER( + statusBarAnimation = self.visible ? self.leftMenuViewController.preferredStatusBarUpdateAnimation : self.contentViewController.preferredStatusBarUpdateAnimation; + if (self.contentViewContainer.frame.origin.y > 10) { + statusBarAnimation = self.leftMenuViewController.preferredStatusBarUpdateAnimation; + } else { + statusBarAnimation = self.contentViewController.preferredStatusBarUpdateAnimation; + } + ); + return statusBarAnimation; +} + +@end diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.h b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.h new file mode 100755 index 00000000..ac46ca65 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.h @@ -0,0 +1,39 @@ +// +// UIViewController+RESideMenu.h +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import + +@class RESideMenu; + +@interface UIViewController (RESideMenu) + +@property (strong, readonly, nonatomic) RESideMenu *sideMenuViewController; + +// IB Action Helper methods + +- (IBAction)presentLeftMenuViewController:(id)sender; +- (IBAction)presentRightMenuViewController:(id)sender; + +@end diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.m b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.m new file mode 100755 index 00000000..46d0e8fe --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenu/UIViewController+RESideMenu.m @@ -0,0 +1,59 @@ +// +// UIViewController+RESideMenu.m +// RESideMenu +// +// Copyright (c) 2013-2014 Roman Efimov (https://github.com/romaonthego) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#import "UIViewController+RESideMenu.h" +#import "RESideMenu.h" + +@implementation UIViewController (RESideMenu) + +- (RESideMenu *)sideMenuViewController +{ + UIViewController *iter = self.parentViewController; + while (iter) { + if ([iter isKindOfClass:[RESideMenu class]]) { + return (RESideMenu *)iter; + } else if (iter.parentViewController && iter.parentViewController != iter) { + iter = iter.parentViewController; + } else { + iter = nil; + } + } + return nil; +} + +#pragma mark - +#pragma mark IB Action Helper methods + +- (IBAction)presentLeftMenuViewController:(id)sender +{ + [self.sideMenuViewController presentLeftMenuViewController]; +} + +- (IBAction)presentRightMenuViewController:(id)sender +{ + [self.sideMenuViewController presentRightMenuViewController]; +} + +@end diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift-Bridging-header.h b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift-Bridging-header.h new file mode 100644 index 00000000..38bac660 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift-Bridging-header.h @@ -0,0 +1,9 @@ +// +// potto.h +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +#import "RESideMenu.h" \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.pbxproj b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.pbxproj new file mode 100644 index 00000000..f62bf1ff --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.pbxproj @@ -0,0 +1,476 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + C26E24D41B9FB1DB0006A2DC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E24D31B9FB1DB0006A2DC /* AppDelegate.swift */; }; + C26E24D61B9FB1DB0006A2DC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E24D51B9FB1DB0006A2DC /* ViewController.swift */; }; + C26E24D91B9FB1DB0006A2DC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C26E24D71B9FB1DB0006A2DC /* Main.storyboard */; }; + C26E24DB1B9FB1DB0006A2DC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C26E24DA1B9FB1DB0006A2DC /* Images.xcassets */; }; + C26E24DE1B9FB1DB0006A2DC /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C26E24DC1B9FB1DB0006A2DC /* LaunchScreen.xib */; }; + C26E24EA1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E24E91B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.swift */; }; + C26E24FA1B9FC1DD0006A2DC /* RECommonFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E24F51B9FC1DD0006A2DC /* RECommonFunctions.m */; }; + C26E24FB1B9FC1DD0006A2DC /* RESideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E24F71B9FC1DD0006A2DC /* RESideMenu.m */; }; + C26E24FC1B9FC1DD0006A2DC /* UIViewController+RESideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = C26E24F91B9FC1DD0006A2DC /* UIViewController+RESideMenu.m */; }; + C26E24FE1B9FC2000006A2DC /* DEMORootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E24FD1B9FC2000006A2DC /* DEMORootViewController.swift */; }; + C26E25001B9FC2A70006A2DC /* DEMOFirstViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E24FF1B9FC2A70006A2DC /* DEMOFirstViewController.swift */; }; + C26E25051B9FC5620006A2DC /* DEMOLeftMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E25041B9FC5620006A2DC /* DEMOLeftMenuViewController.swift */; }; + C26E25071B9FC5870006A2DC /* DEMORightMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C26E25061B9FC5870006A2DC /* DEMORightMenuViewController.swift */; }; + C2F3562C1B9FEE980064901B /* DEMOSecondViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F3562B1B9FEE980064901B /* DEMOSecondViewController.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C26E24E41B9FB1DB0006A2DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C26E24C61B9FB1DB0006A2DC /* Project object */; + proxyType = 1; + remoteGlobalIDString = C26E24CD1B9FB1DB0006A2DC; + remoteInfo = RESideMenuStoryboardsExampleSwift; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + C26E24CE1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RESideMenuStoryboardsExampleSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C26E24D21B9FB1DB0006A2DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C26E24D31B9FB1DB0006A2DC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + C26E24D51B9FB1DB0006A2DC /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + C26E24D81B9FB1DB0006A2DC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + C26E24DA1B9FB1DB0006A2DC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + C26E24DD1B9FB1DB0006A2DC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + C26E24E31B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RESideMenuStoryboardsExampleSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + C26E24E81B9FB1DB0006A2DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C26E24E91B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RESideMenuStoryboardsExampleSwiftTests.swift; sourceTree = ""; }; + C26E24F41B9FC1DD0006A2DC /* RECommonFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RECommonFunctions.h; sourceTree = ""; }; + C26E24F51B9FC1DD0006A2DC /* RECommonFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RECommonFunctions.m; sourceTree = ""; }; + C26E24F61B9FC1DD0006A2DC /* RESideMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RESideMenu.h; sourceTree = ""; }; + C26E24F71B9FC1DD0006A2DC /* RESideMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RESideMenu.m; sourceTree = ""; }; + C26E24F81B9FC1DD0006A2DC /* UIViewController+RESideMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+RESideMenu.h"; sourceTree = ""; }; + C26E24F91B9FC1DD0006A2DC /* UIViewController+RESideMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+RESideMenu.m"; sourceTree = ""; }; + C26E24FD1B9FC2000006A2DC /* DEMORootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DEMORootViewController.swift; sourceTree = ""; }; + C26E24FF1B9FC2A70006A2DC /* DEMOFirstViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DEMOFirstViewController.swift; sourceTree = ""; }; + C26E25011B9FC3AF0006A2DC /* RESideMenuStoryboardsExampleSwift-Bridging-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RESideMenuStoryboardsExampleSwift-Bridging-header.h"; sourceTree = ""; }; + C26E25041B9FC5620006A2DC /* DEMOLeftMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DEMOLeftMenuViewController.swift; sourceTree = ""; }; + C26E25061B9FC5870006A2DC /* DEMORightMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DEMORightMenuViewController.swift; sourceTree = ""; }; + C2F3562B1B9FEE980064901B /* DEMOSecondViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DEMOSecondViewController.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C26E24CB1B9FB1DB0006A2DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C26E24E01B9FB1DB0006A2DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C26E24C51B9FB1DB0006A2DC = { + isa = PBXGroup; + children = ( + C26E25011B9FC3AF0006A2DC /* RESideMenuStoryboardsExampleSwift-Bridging-header.h */, + C26E24F31B9FC1DD0006A2DC /* RESideMenu */, + C26E24D01B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift */, + C26E24E61B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests */, + C26E24CF1B9FB1DB0006A2DC /* Products */, + ); + sourceTree = ""; + }; + C26E24CF1B9FB1DB0006A2DC /* Products */ = { + isa = PBXGroup; + children = ( + C26E24CE1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift.app */, + C26E24E31B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + C26E24D01B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift */ = { + isa = PBXGroup; + children = ( + C26E24D31B9FB1DB0006A2DC /* AppDelegate.swift */, + C26E24D51B9FB1DB0006A2DC /* ViewController.swift */, + C26E24D71B9FB1DB0006A2DC /* Main.storyboard */, + C2F3562B1B9FEE980064901B /* DEMOSecondViewController.swift */, + C26E24FF1B9FC2A70006A2DC /* DEMOFirstViewController.swift */, + C26E24FD1B9FC2000006A2DC /* DEMORootViewController.swift */, + C26E25061B9FC5870006A2DC /* DEMORightMenuViewController.swift */, + C26E25041B9FC5620006A2DC /* DEMOLeftMenuViewController.swift */, + C26E24DA1B9FB1DB0006A2DC /* Images.xcassets */, + C26E24DC1B9FB1DB0006A2DC /* LaunchScreen.xib */, + C26E24D11B9FB1DB0006A2DC /* Supporting Files */, + ); + path = RESideMenuStoryboardsExampleSwift; + sourceTree = ""; + }; + C26E24D11B9FB1DB0006A2DC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + C26E24D21B9FB1DB0006A2DC /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + C26E24E61B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests */ = { + isa = PBXGroup; + children = ( + C26E24E91B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.swift */, + C26E24E71B9FB1DB0006A2DC /* Supporting Files */, + ); + path = RESideMenuStoryboardsExampleSwiftTests; + sourceTree = ""; + }; + C26E24E71B9FB1DB0006A2DC /* Supporting Files */ = { + isa = PBXGroup; + children = ( + C26E24E81B9FB1DB0006A2DC /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + C26E24F31B9FC1DD0006A2DC /* RESideMenu */ = { + isa = PBXGroup; + children = ( + C26E24F41B9FC1DD0006A2DC /* RECommonFunctions.h */, + C26E24F51B9FC1DD0006A2DC /* RECommonFunctions.m */, + C26E24F61B9FC1DD0006A2DC /* RESideMenu.h */, + C26E24F71B9FC1DD0006A2DC /* RESideMenu.m */, + C26E24F81B9FC1DD0006A2DC /* UIViewController+RESideMenu.h */, + C26E24F91B9FC1DD0006A2DC /* UIViewController+RESideMenu.m */, + ); + path = RESideMenu; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C26E24CD1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = C26E24ED1B9FB1DB0006A2DC /* Build configuration list for PBXNativeTarget "RESideMenuStoryboardsExampleSwift" */; + buildPhases = ( + C26E24CA1B9FB1DB0006A2DC /* Sources */, + C26E24CB1B9FB1DB0006A2DC /* Frameworks */, + C26E24CC1B9FB1DB0006A2DC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RESideMenuStoryboardsExampleSwift; + productName = RESideMenuStoryboardsExampleSwift; + productReference = C26E24CE1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift.app */; + productType = "com.apple.product-type.application"; + }; + C26E24E21B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = C26E24F01B9FB1DB0006A2DC /* Build configuration list for PBXNativeTarget "RESideMenuStoryboardsExampleSwiftTests" */; + buildPhases = ( + C26E24DF1B9FB1DB0006A2DC /* Sources */, + C26E24E01B9FB1DB0006A2DC /* Frameworks */, + C26E24E11B9FB1DB0006A2DC /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C26E24E51B9FB1DB0006A2DC /* PBXTargetDependency */, + ); + name = RESideMenuStoryboardsExampleSwiftTests; + productName = RESideMenuStoryboardsExampleSwiftTests; + productReference = C26E24E31B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C26E24C61B9FB1DB0006A2DC /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0640; + ORGANIZATIONNAME = "Lucas Farah"; + TargetAttributes = { + C26E24CD1B9FB1DB0006A2DC = { + CreatedOnToolsVersion = 6.4; + }; + C26E24E21B9FB1DB0006A2DC = { + CreatedOnToolsVersion = 6.4; + TestTargetID = C26E24CD1B9FB1DB0006A2DC; + }; + }; + }; + buildConfigurationList = C26E24C91B9FB1DB0006A2DC /* Build configuration list for PBXProject "RESideMenuStoryboardsExampleSwift" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C26E24C51B9FB1DB0006A2DC; + productRefGroup = C26E24CF1B9FB1DB0006A2DC /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C26E24CD1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift */, + C26E24E21B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C26E24CC1B9FB1DB0006A2DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C26E24D91B9FB1DB0006A2DC /* Main.storyboard in Resources */, + C26E24DE1B9FB1DB0006A2DC /* LaunchScreen.xib in Resources */, + C26E24DB1B9FB1DB0006A2DC /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C26E24E11B9FB1DB0006A2DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C26E24CA1B9FB1DB0006A2DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C26E24FB1B9FC1DD0006A2DC /* RESideMenu.m in Sources */, + C26E24D61B9FB1DB0006A2DC /* ViewController.swift in Sources */, + C26E24FC1B9FC1DD0006A2DC /* UIViewController+RESideMenu.m in Sources */, + C2F3562C1B9FEE980064901B /* DEMOSecondViewController.swift in Sources */, + C26E25001B9FC2A70006A2DC /* DEMOFirstViewController.swift in Sources */, + C26E24FE1B9FC2000006A2DC /* DEMORootViewController.swift in Sources */, + C26E24FA1B9FC1DD0006A2DC /* RECommonFunctions.m in Sources */, + C26E25051B9FC5620006A2DC /* DEMOLeftMenuViewController.swift in Sources */, + C26E24D41B9FB1DB0006A2DC /* AppDelegate.swift in Sources */, + C26E25071B9FC5870006A2DC /* DEMORightMenuViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C26E24DF1B9FB1DB0006A2DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C26E24EA1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwiftTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + C26E24E51B9FB1DB0006A2DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C26E24CD1B9FB1DB0006A2DC /* RESideMenuStoryboardsExampleSwift */; + targetProxy = C26E24E41B9FB1DB0006A2DC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + C26E24D71B9FB1DB0006A2DC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C26E24D81B9FB1DB0006A2DC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + C26E24DC1B9FB1DB0006A2DC /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + C26E24DD1B9FB1DB0006A2DC /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C26E24EB1B9FB1DB0006A2DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + C26E24EC1B9FB1DB0006A2DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.4; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C26E24EE1B9FB1DB0006A2DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = RESideMenuStoryboardsExampleSwift/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "RESideMenuStoryboardsExampleSwift-Bridging-header.h"; + }; + name = Debug; + }; + C26E24EF1B9FB1DB0006A2DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = RESideMenuStoryboardsExampleSwift/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "RESideMenuStoryboardsExampleSwift-Bridging-header.h"; + }; + name = Release; + }; + C26E24F11B9FB1DB0006A2DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = RESideMenuStoryboardsExampleSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RESideMenuStoryboardsExampleSwift.app/RESideMenuStoryboardsExampleSwift"; + }; + name = Debug; + }; + C26E24F21B9FB1DB0006A2DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = RESideMenuStoryboardsExampleSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RESideMenuStoryboardsExampleSwift.app/RESideMenuStoryboardsExampleSwift"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C26E24C91B9FB1DB0006A2DC /* Build configuration list for PBXProject "RESideMenuStoryboardsExampleSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C26E24EB1B9FB1DB0006A2DC /* Debug */, + C26E24EC1B9FB1DB0006A2DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C26E24ED1B9FB1DB0006A2DC /* Build configuration list for PBXNativeTarget "RESideMenuStoryboardsExampleSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C26E24EE1B9FB1DB0006A2DC /* Debug */, + C26E24EF1B9FB1DB0006A2DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C26E24F01B9FB1DB0006A2DC /* Build configuration list for PBXNativeTarget "RESideMenuStoryboardsExampleSwiftTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C26E24F11B9FB1DB0006A2DC /* Debug */, + C26E24F21B9FB1DB0006A2DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C26E24C61B9FB1DB0006A2DC /* Project object */; +} diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..cf9bd9ea --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/xcuserdata/lucasfarah.xcuserdatad/UserInterfaceState.xcuserstate b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/xcuserdata/lucasfarah.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..e86a88ab Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/project.xcworkspace/xcuserdata/lucasfarah.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 00000000..fe2b4541 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/RESideMenuStoryboardsExampleSwift.xcscheme b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/RESideMenuStoryboardsExampleSwift.xcscheme new file mode 100644 index 00000000..08e3ef5a --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/RESideMenuStoryboardsExampleSwift.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/xcschememanagement.plist b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..826b0267 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift.xcodeproj/xcuserdata/lucasfarah.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + RESideMenuStoryboardsExampleSwift.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + C26E24CD1B9FB1DB0006A2DC + + primary + + + C26E24E21B9FB1DB0006A2DC + + primary + + + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/AppDelegate.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/AppDelegate.swift new file mode 100644 index 00000000..0e4d74da --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(application: UIApplication) { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/LaunchScreen.xib b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/LaunchScreen.xib new file mode 100644 index 00000000..e4333ce5 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/Main.storyboard b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/Main.storyboard new file mode 100644 index 00000000..3c3ffa8d --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Base.lproj/Main.storyboard @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOFirstViewController.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOFirstViewController.swift new file mode 100644 index 00000000..93e9435d --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOFirstViewController.swift @@ -0,0 +1,35 @@ +// +// DEMOFirstViewController.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +class DEMOFirstViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOLeftMenuViewController.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOLeftMenuViewController.swift new file mode 100644 index 00000000..90c0bd87 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMOLeftMenuViewController.swift @@ -0,0 +1,101 @@ +// +// DEMOLeftMenuViewController.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +class DEMOLeftMenuViewController: UIViewController,UITableViewDataSource,UITableViewDelegate,RESideMenuDelegate { + + @IBOutlet weak var tableView: UITableView! + + override func viewDidLoad() { + super.viewDidLoad() + + self.view.backgroundColor = UIColor.clearColor() + + let table = UITableView(frame: CGRectMake(0, (self.view.frame.size.height-54*5)/2.0, self.view.frame.size.width, 54*5), style: .Plain) + table.autoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth + table.delegate = self + table.dataSource = self + table.opaque = false + table.backgroundColor = UIColor.clearColor() + table.backgroundView = nil + table.separatorStyle = .None + table.bounces = false + table.scrollsToTop = false + + self.tableView = table + self.view.addSubview(self.tableView) + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int + { + return 5 + } + + func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat + { + return 54 + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell + { + var cell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell! + if cell == nil + { + cell = UITableViewCell(style:.Default, reuseIdentifier: "cell") + cell.backgroundColor = UIColor.clearColor() + cell.textLabel?.font = UIFont(name: "HelveticaNeue", size: 21) + cell.textLabel?.textColor = UIColor.whiteColor() + cell.textLabel?.highlightedTextColor = UIColor.lightGrayColor() + cell.selectedBackgroundView = UIView() + } + + let titles = ["Home", "Calendar", "Profile", "Settings", "Log Out"] + let images = ["IconHome", "IconCalendar", "IconProfile", "IconSettings", "IconEmpty"] + cell.textLabel!.text = titles[indexPath.row] + cell.imageView!.image = UIImage(named: images[indexPath.row]) + + return cell + } + + func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) + { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + switch indexPath.row + { + case 0: + self.sideMenuViewController.setContentViewController(UINavigationController(rootViewController: self.storyboard?.instantiateViewControllerWithIdentifier("firstViewController")as! UIViewController), animated: true) + self.sideMenuViewController.hideMenuViewController() + + case 1: + self.sideMenuViewController.setContentViewController(UINavigationController(rootViewController: self.storyboard?.instantiateViewControllerWithIdentifier("secondViewController")as! UIViewController), animated: true) + self.sideMenuViewController.hideMenuViewController() + + default: + break + } + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORightMenuViewController.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORightMenuViewController.swift new file mode 100644 index 00000000..6f04830a --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORightMenuViewController.swift @@ -0,0 +1,85 @@ +// +// DEMORightMenuViewController.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +class DEMORightMenuViewController: UIViewController,UITableViewDataSource,UITableViewDelegate { + + @IBOutlet weak var tableView: UITableView! + + override func viewDidLoad() { + super.viewDidLoad() + self.view.backgroundColor = UIColor.clearColor() + + let table = UITableView(frame: CGRectMake(0, (self.view.frame.size.height-54*5)/2.0, self.view.frame.size.width, 54*5), style: .Plain) + table.autoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth + table.delegate = self + table.dataSource = self + table.opaque = false + table.backgroundColor = UIColor.clearColor() + table.backgroundView = nil + table.separatorStyle = .None + table.bounces = false + table.scrollsToTop = false + + self.tableView = table + self.view.addSubview(self.tableView) + + } + + func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int + { + return 2 + } + + func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat + { + return 54 + } + + func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell + { + var cell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell! + if cell == nil + { + cell = UITableViewCell(style:.Default, reuseIdentifier: "cell") + cell.backgroundColor = UIColor.clearColor() + cell.textLabel?.font = UIFont(name: "HelveticaNeue", size: 21) + cell.textLabel?.textColor = UIColor.whiteColor() + cell.textLabel?.highlightedTextColor = UIColor.lightGrayColor() + cell.selectedBackgroundView = UIView() + } + + let titles = ["Test 1", "Test 2"] + cell.textLabel!.text = titles[indexPath.row] + cell.textLabel?.textAlignment = .Right + return cell + + } + + func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) + { + tableView.deselectRowAtIndexPath(indexPath, animated: true) + switch indexPath.row + { + case 0: + self.sideMenuViewController.setContentViewController(UINavigationController(rootViewController: self.storyboard?.instantiateViewControllerWithIdentifier("firstViewController")as! UIViewController), animated: true) + self.sideMenuViewController.hideMenuViewController() + + case 1: + self.sideMenuViewController.setContentViewController(UINavigationController(rootViewController: self.storyboard?.instantiateViewControllerWithIdentifier("secondViewController")as! UIViewController), animated: true) + self.sideMenuViewController.hideMenuViewController() + + default: + break + } + + } + + +} diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORootViewController.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORootViewController.swift new file mode 100644 index 00000000..2379e2f2 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/DEMORootViewController.swift @@ -0,0 +1,60 @@ +// +// DEMORootViewController.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +class DEMORootViewController: RESideMenu,RESideMenuDelegate { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + override func awakeFromNib() + { + self.menuPreferredStatusBarStyle = .LightContent; + self.contentViewShadowColor = UIColor.blackColor() + self.contentViewShadowOffset = CGSizeMake(0, 0) + self.contentViewShadowOpacity = 0.6 + self.contentViewShadowRadius = 12 + self.contentViewShadowEnabled = true + + self.contentViewController = self.storyboard?.instantiateViewControllerWithIdentifier("contentViewController") as! UIViewController + self.leftMenuViewController = self.storyboard?.instantiateViewControllerWithIdentifier("leftMenuViewController") as! UIViewController + self.rightMenuViewController = self.storyboard?.instantiateViewControllerWithIdentifier("rightMenuViewController") as! UIViewController + self.backgroundImage = UIImage(named: "Stars") + self.delegate = self + } + + //MARK: RESideMenu Delegate + func sideMenu(sideMenu: RESideMenu!, willShowMenuViewController menuViewController: UIViewController!) + { + let str = NSStringFromClass(menuViewController.classForCoder) + println("willShowMenuViewController: \(str)") + } + func sideMenu(sideMenu: RESideMenu!, didShowMenuViewController menuViewController: UIViewController!) + { + let str = NSStringFromClass(menuViewController.classForCoder) + println("didShowMenuViewController: \(str)") + + } + func sideMenu(sideMenu: RESideMenu!, willHideMenuViewController menuViewController: UIViewController!) + { + let str = NSStringFromClass(menuViewController.classForCoder) + println("willHideMenuViewController: \(str)") + + } + func sideMenu(sideMenu: RESideMenu!, didHideMenuViewController menuViewController: UIViewController!) + { + let str = NSStringFromClass(menuViewController.classForCoder) + println("didHideMenuViewController: \(str)") + + } + +} diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..118c98f7 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,38 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Balloon@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Balloon@2x.png new file mode 100644 index 00000000..7f3020d7 Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Balloon@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Contents.json new file mode 100644 index 00000000..e0b9007e --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Balloon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "Balloon@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Contents.json new file mode 100644 index 00000000..b1e0836a --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "Icon@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Icon@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Icon@2x.png new file mode 100644 index 00000000..9751ab4a Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Icon.imageset/Icon@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/Contents.json new file mode 100644 index 00000000..3fefd39e --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "IconCalendar@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/IconCalendar@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/IconCalendar@2x.png new file mode 100644 index 00000000..de237e26 Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconCalendar.imageset/IconCalendar@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/Contents.json new file mode 100644 index 00000000..e835c806 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "IconEmpty@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/IconEmpty@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/IconEmpty@2x.png new file mode 100644 index 00000000..b5dfd6cf Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconEmpty.imageset/IconEmpty@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/Contents.json new file mode 100644 index 00000000..709cdebf --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "IconHome@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/IconHome@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/IconHome@2x.png new file mode 100644 index 00000000..58c2dcde Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconHome.imageset/IconHome@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/Contents.json new file mode 100644 index 00000000..645c055f --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "IconProfile@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/IconProfile@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/IconProfile@2x.png new file mode 100644 index 00000000..47012fce Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconProfile.imageset/IconProfile@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/Contents.json new file mode 100644 index 00000000..811cf5b2 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "IconSettings@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/IconSettings@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/IconSettings@2x.png new file mode 100644 index 00000000..404934f0 Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/IconSettings.imageset/IconSettings@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000..131e75b2 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,42 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-5.5.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "Default-4.7.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "Default-568h@2x.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-4.7.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-4.7.png new file mode 100644 index 00000000..0a753e4e Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-4.7.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-5.5.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-5.5.png new file mode 100644 index 00000000..e9e6dd1e Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-5.5.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 00000000..0891b7aa Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/Contents.json new file mode 100644 index 00000000..d06ee604 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "MenuBackground@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/MenuBackground@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/MenuBackground@2x.png new file mode 100644 index 00000000..6570fe99 Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/MenuBackground.imageset/MenuBackground@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Contents.json b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Contents.json new file mode 100644 index 00000000..cd601bce --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "Stars@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Stars@2x.png b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Stars@2x.png new file mode 100644 index 00000000..78204668 Binary files /dev/null and b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Images.xcassets/Stars.imageset/Stars@2x.png differ diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Info.plist b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Info.plist new file mode 100644 index 00000000..fa7fd92f --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/Info.plist @@ -0,0 +1,40 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + farah.lucas.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/ViewController.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/ViewController.swift new file mode 100644 index 00000000..da78ad2e --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwift/ViewController.swift @@ -0,0 +1,25 @@ +// +// ViewController.swift +// RESideMenuStoryboardsExampleSwift +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + // Do any additional setup after loading the view, typically from a nib. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + +} + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/Info.plist b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/Info.plist new file mode 100644 index 00000000..e460a3ea --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + farah.lucas.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/RESideMenuStoryboardsExampleSwiftTests.swift b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/RESideMenuStoryboardsExampleSwiftTests.swift new file mode 100644 index 00000000..c7e6f637 --- /dev/null +++ b/Examples/Storyboards/RESideMenuStoryboardsExampleSwift/RESideMenuStoryboardsExampleSwiftTests/RESideMenuStoryboardsExampleSwiftTests.swift @@ -0,0 +1,36 @@ +// +// RESideMenuStoryboardsExampleSwiftTests.swift +// RESideMenuStoryboardsExampleSwiftTests +// +// Created by Lucas Farah on 9/8/15. +// Copyright (c) 2015 Lucas Farah. All rights reserved. +// + +import UIKit +import XCTest + +class RESideMenuStoryboardsExampleSwiftTests: XCTestCase { + + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testExample() { + // This is an example of a functional test case. + XCTAssert(true, "Pass") + } + + func testPerformanceExample() { + // This is an example of a performance test case. + self.measureBlock() { + // Put the code you want to measure the time of here. + } + } + +}