From 607fa09388f2f84e4f06fb614705d7e3800e56bd Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Tue, 5 Mar 2019 15:11:34 -0500 Subject: [PATCH] Add additional initializer to allow for an alternate swipe delegate. --- MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.h | 2 ++ MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.m | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.h b/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.h index ca22d3f8..b08129f0 100644 --- a/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.h +++ b/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.h @@ -30,4 +30,6 @@ - (nullable instancetype)initWithViewController:(nullable UIViewController*)delegate; +- (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController delegate:(nullable id)delegate; + @end diff --git a/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.m b/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.m index 7557c47f..de20ef53 100644 --- a/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.m +++ b/MVMCoreUI/Containers/TabBarController/MFTabBarInteractor.m @@ -28,9 +28,13 @@ typedef NS_ENUM(NSUInteger, MFTabBarPanningDirection) { @implementation MFTabBarInteractor - (nullable instancetype)initWithViewController:(nullable UIViewController *)delegate { + return [self initWithViewController:delegate delegate:delegate]; +} + +- (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController delegate:(nullable id)delegate { if (self = [super init]) { self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)]; - [delegate.view addGestureRecognizer:self.panGesture]; + [viewController.view addGestureRecognizer:self.panGesture]; self.delegate = delegate; } return self;