feat:move navigator to another class for iOS
This commit is contained in:
10
iOS/Pod/Classes/Navigator/DoricDefaultNavigator.h
Normal file
10
iOS/Pod/Classes/Navigator/DoricDefaultNavigator.h
Normal 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
|
29
iOS/Pod/Classes/Navigator/DoricDefaultNavigator.m
Normal file
29
iOS/Pod/Classes/Navigator/DoricDefaultNavigator.m
Normal 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
|
Reference in New Issue
Block a user