feat:move navigator to another class for iOS

This commit is contained in:
pengfei.zhou
2019-11-25 10:50:27 +08:00
parent f750eb6cae
commit 844d44a6f0
8 changed files with 48 additions and 20 deletions

View File

@@ -0,0 +1,10 @@
//
// Created by pengfei.zhou on 2019/11/25.
//
#import <Foundation/Foundation.h>
#import "DoricNavigatorProtocol.h"
@interface DoricDefaultNavigator : NSObject <DoricNavigatorProtocol>
- (instancetype)initWithNavigationController:(UINavigationController *)navigationController;
@end

View File

@@ -0,0 +1,29 @@
//
// Created by pengfei.zhou on 2019/11/25.
//
#import "DoricDefaultNavigator.h"
#import "DoricViewController.h"
@interface DoricDefaultNavigator ()
@property(nonatomic, weak) UINavigationController *navigationController;
@end
@implementation DoricDefaultNavigator
- (instancetype)initWithNavigationController:(UINavigationController *)navigationController {
if (self = [super init]) {
_navigationController = navigationController;
}
return self;
}
- (void)push:(NSString *)scheme alias:(NSString *)alias animated:(BOOL)animated {
DoricViewController *viewController = [[DoricViewController alloc] initWithScheme:scheme alias:alias];
[self.navigationController pushViewController:viewController animated:animated];
}
- (void)pop:(BOOL)animated {
[self.navigationController popViewControllerAnimated:animated];
}
@end