Commit 6f7d0a6a authored by jz's avatar jz

add commons

parent 8e52ca96
//
// Target_commons.h
// GMRouter
//
// Created by Q14 on 2019/11/28.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString * const GMRouterTargetCommons;
@interface Target_commons : NSObject
// 自定义push方法
- (UIViewController *)push_CommonViewController:(NSString *)stringVCName params:(NSDictionary *)params;
@end
NS_ASSUME_NONNULL_END
//
// Target_commons.m
// GMRouter
//
// Created by Q14 on 2019/11/28.
//
#import "Target_commons.h"
NSString * const GMRouterTargetCommons = @"commons";
@implementation Target_commons
// 自定义push方法
- (UIViewController *)push_CommonViewController:(NSString *)stringVCName params:(NSDictionary *)params {
// 因为action是从属于ModuleA的,所以action直接可以使用ModuleA里的所有声明
Class class = NSClassFromString(stringVCName);
UIViewController *controller = [[class alloc] init];
return controller;
}
@end
//
// UIViewController+Router.h
// GMRouter
//
// Created by Q14 on 2019/11/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIViewController (Router)
- (id)createVC:(NSDictionary *)dict;
@end
NS_ASSUME_NONNULL_END
//
// UIViewController+Router.m
// GMRouter
//
// Created by Q14 on 2019/11/28.
//
#import "UIViewController+Router.h"
#import "GMRouter+gm.h"
@implementation UIViewController (Router)
- (id)createVC:(NSDictionary *)dict{
Class class = getClassFromAtcion(_cmd);
if (class) {
UIViewController *doc = self;
doc = [[class alloc]init];
// doc = [doc mj_setKeyValues:dict];
return doc;
}
return nil;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment