Job-Yang/JYRouter
About
🚀 Router framework is based on runtime to push/present/pop/dismiss for iOS.
Web & App DevelopmentWhat you can do
- Compatibility: Support for Objective-C and Swift
- Ease of use: Support property auto assignment and completion callback
- Low coupling: No need to inherit the base class or follow the protocol, plug and play
- Applicability: Supports jumps other than UIViewController
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalJYRouter
Router framework is based on runtime to push/present/pop/dismiss for iOS
Features
Compatibility: Support for Objective-C and Swift
Ease of use: Support property auto assignment and completion callback
Low coupling: No need to inherit the base class or follow the protocol, plug and play
Applicability: Supports jumps other than UIViewController
Usage
Jump
Objective-C
// Push
[[JYRouter router] push:@"JYViewController"];
// Push, Params
NSDictionary *params1 = @{ @"title" : @"JYRouter"};
[[JYRouter router] push:@"JYViewController" animated:YES params:params1];
// Push, Params, Callback
NSDictionary *params2 = @{@"type" : @(0)};
[[JYRouter router] push:@"JYViewController" animated:YES params:params2 completion:^{
NSLog(@"🔥🔥🔥Push completion callback🔥🔥🔥");
}];
Swift
// Push
JYRouter().push("JYViewController")
// Push, Params
let params1 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params1)
// Push, Params, Callback
let params2 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params2, completion: {
print("🔥🔥🔥Push completion callback🔥🔥🔥")
})
Custom NavigationController
Objective-C
// Set in AppDelegate
[[JYRouter router] setCustomNavigationClass:[JYNavigationController class]];
Swift
// Set in AppDelegate
JYRouter().setCustomNavigationClass(JYNavigationController.self)
Installation
CocoaPods
Add
pod 'JYRouter'to your Podfile.Run
pod installorpod update.Objective-C:
#import "JYRouter.h"
Swift:
- Create
"YourProjectName-Bridging-Header.h"bridging header file #import "JYRouter.h"in the bridging header file
Manually
Download all the files in the
JYRoutersubdirectory.Add the source files to your Xcode project.
Objective-C:
#import "JYRouter.h"
Swift:
- Create
"YourProjectName-Bridging-Header.h"bridging header file #import "JYRouter.h"in the bridging header file
License
JYRouter is released under the MIT license. See LICENSE file for details.
中文介绍
基于runtime实现的iOS路由框架
特性
- 兼容性: 支持Objective-C和Swift
- 易用性: 支持属性自动赋值和完成回调
- 低耦合: 无需继承基类或遵循协议,即插即用
- 适用性: 支持UIViewController之外其他类的跳转
使用方法
Jump
Objective-C
// Push跳转
[[JYRouter router] push:@"JYViewController"];
// Push跳转,附带参数
NSDictionary *params1 = @{@"title" : @"JYRouter"};
[[JYRouter router] push:@"JYViewController" animated:YES params:params1];
// Push跳转,附带参数,完成回调
NSDictionary *params2 = @{@"type" : @(0)};
[[JYRouter router] push:@"JYViewController" animated:YES params:params2 completion:^{
NSLog(@"🔥🔥🔥Push完成回调🔥🔥🔥");
}];
Swift
// Push跳转
JYRouter().push("JYViewController")
// Push跳转,附带参数
let params1 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params1)
// Push跳转,附带参数,完成回调
let params2 = ["title" : "JYRouter"]
JYRouter().push("JYViewController", animated: true, params: params2, completion: {
print("🔥🔥🔥Push完成回调🔥🔥🔥")
})
自定义NavigationController
Objective-C
// 在AppDelegate设置
[[JYRouter router] setCustomNavigationClass:[JYNavigationController class]];
Swift
// 在AppDelegate设置
JYRouter().setCustomNavigationClass(JYNavigationController.self)
安装
CocoaPods
在 Podfile 中添加 pod 'JYRouter'。
执行 pod install 或 pod update。
Objective-C:
#import "JYRouter.h"
Swift:
- 建立
"你的工程名-Bridging-Header.h"桥接文件 - 在该桥接文件中
#import "JYRouter.h"
手动安装
下载 JYRouter 文件夹内的所有内容。
将 JYRouter 内的源文件添加(拖放)到你的工程。
Objective-C:
#import "JYRouter.h"
Swift:
- 建立
"你的工程名-Bridging-Header.h"桥接文件 - 在该桥接文件中
#import "JYRouter.h"
许可证
JYRouter 使用 MIT 许可证,详情见 LICENSE 文件。
Explore related projects
Loading…