Commit fcc2cd96 authored by jz's avatar jz

update

parent edffb438
......@@ -5,7 +5,7 @@ PODS:
- GMCache
- MagicalRecord
- MJExtension
- GMRouter (0.1.9):
- GMRouter (0.2.1):
- GMPhobos
- MJExtension
- MagicalRecord (2.3.2):
......@@ -33,7 +33,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMPhobos: 981b9c9509945eaa28b4ad6a5376eb78f3fd54b5
GMRouter: 5816ada735703b351c3bfbb0e68743dcb37ec4a6
GMRouter: e11d4416f0070fe3a93180acded1403d0200ad61
MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
......
......@@ -6,7 +6,7 @@
//
#import "GMRouter.h"
#import "UIViewController+router.h"
#import "UIResponder+router.h"
NS_ASSUME_NONNULL_BEGIN
......@@ -20,14 +20,16 @@ extern NSString *const GMRouterProtocolPrefix;
/**
* 通过协议 跳转到对应的vc
* @param urlScheme 协议名字 * 例如gengmei://welfare_special?service_id=5930&is_new_special=0
* @param urlScheme 协议名字
* 例如gengmei://welfare_special?service_id=5930&is_new_special=0
* @return vc的实例
*/
- (id)pushScheme:(NSString *)urlScheme;
/**
* 通过协议 跳转到对应的vc
* @param urlScheme 协议名字 * 例如gengmei://welfare_special?service_id=5930&is_new_special=0
* @param urlScheme 协议名字
* 例如gengmei://welfare_special?service_id=5930&is_new_special=0
* @param routerBlock 需要回调的block
* @return vc的实例
*/
......@@ -41,7 +43,7 @@ extern NSString *const GMRouterProtocolPrefix;
* {@"service_id": @"5930",@"is_new_special": @0}
* @return vc的实例
*/
- (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params completeBlock:(GMRouterBlock)routerBlock;
- (id)pushScheme:(NSString *)urlScheme params:(NSDictionary *)params routerBlock:(GMRouterBlock)routerBlock;
/**
* 初始化Map
......
......@@ -72,6 +72,12 @@ static NSMutableDictionary *routeMap = nil;
[self vcAutoIsPushWith:vc params:params];
VC.routerBlock = routerBlock;
}
// 赋值回调过程
if ([vc isKindOfClass:[UIResponder class]]) {
UIResponder *VC = (UIResponder *)vc;
VC.routerBlock = routerBlock;
}
return vc;
}
......
//
// UIViewController+router.h
// GMCache
//
// Created by Q14 on 2020/8/10.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void(^GMRouterBlock)(NSDictionary *params);
@interface UIViewController (router)
@property (nonatomic, copy) GMRouterBlock routerBlock;
@end
NS_ASSUME_NONNULL_END
//
// UIViewController+router.m
// GMCache
//
// Created by Q14 on 2020/8/10.
//
#import "UIViewController+router.h"
#import <objc/runtime.h>
@implementation UIViewController (router)
- (GMRouterBlock)routerBlock {
return objc_getAssociatedObject(self, @selector(routerBlock));
}
- (void)setRouterBlock:(GMRouterBlock)routerBlock {
objc_setAssociatedObject(self, @selector(routerBlock), routerBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
}
@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