Add additional initializer to allow for an alternate swipe delegate.

This commit is contained in:
Hedden, Kyle Matthew 2019-03-05 15:11:34 -05:00
parent e92e87abb2
commit 607fa09388
2 changed files with 7 additions and 1 deletions

View File

@ -30,4 +30,6 @@
- (nullable instancetype)initWithViewController:(nullable UIViewController<MFSwipeNavigationProtocol>*)delegate;
- (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController delegate:(nullable id<MFSwipeNavigationProtocol>)delegate;
@end

View File

@ -28,9 +28,13 @@ typedef NS_ENUM(NSUInteger, MFTabBarPanningDirection) {
@implementation MFTabBarInteractor
- (nullable instancetype)initWithViewController:(nullable UIViewController <MFSwipeNavigationProtocol>*)delegate {
return [self initWithViewController:delegate delegate:delegate];
}
- (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController delegate:(nullable id<MFSwipeNavigationProtocol>)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;