你刚好需要,我刚好出现,请赏一颗小星星.
FZRouter
特征
- 1. 本地路由路径参照Web URL格式设计。
- 2. 支持本地和web路由。
- 3. 支持路由界面唯一性。
- 4. 支持顶层界面刷新。
例
要运行示例项目,请克隆repo,然后从Example目录运行 ”pod install“。
要求
RouterProfile.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>path</key><string>[path映射的VC界面类名]</string>
</dict>
</plist>
安装
FZRouter 可通过CocoaPods获得. 要安装它,只需将以下行添加到Podfile文件
pod 'FZRouter'
怎样使用
- Objective-C
-
- info.plist -> URL Types ->URL Schemes ->"local / [自定义]".
-
- 新建全局路由配置文件“RouterProfile.plist”.
-
- 配置路由单例。
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
[code]...
[FZRouter globalRouter].localScheme = @"local";
[FZRouter globalRouter].unique = true;
[FZRouter registerRoutesWithProfile:@"RouterProfile"];
[code]...
}
-(void)skipAction:(UIButton *)sender{
/**
* 路由路径规则定义
* local://host:port/path?Query=¶ms=
* local://Domin/VCIdentification?q=funcName¶m1=value1¶m2=value2¶m1=value3
*/
[FZRouter open:@"local://path?key1=value1&key2=value2"];
}
//Objective-C代码
- Swift
//swif代码
路由处理逻辑
作者
wufuzeng, [email protected]
纵有疾风起,人生不言弃
许可证
FZRouter is available under the MIT license. See the LICENSE file for more info.