JLRoutes--处理复杂的URL schemes-备
发布日期:2021-09-11 05:53:07 浏览次数:9 分类:技术文章

本文共 1297 字,大约阅读时间需要 4 分钟。

  • 关键字:URL,URL schemes,Parse 
  • 代码类库:网络(Networking)
  • GitHub链接:
 
JLRoutes可简单地处理复杂的URL schemes,无需进行任何类型的URL或者字符串解析。
功能:
Simple API with minimal impact to existing codebases
Parse any number of parameters interleaved throughout the URL
Wildcard parameter support
Seamlessly parses out query string and fragment parameters and passes them along as part of the parameters dictionary
Route prioritization
Scheme namespaces to easily segment routes and block handlers for multiple schemes
Return NO from a handler block for JLRoutes to look for the next matching route
Optional verbose logging
Pretty-print the whole routing table
No dependencies other than Foundation
简单示例
// in your app delegate:- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  // ...  [JLRoutes addRoute:@"/user/view/:userID" handler:^BOOL(NSDictionary *parameters) {    NSString *userID = parameters[@"userID"]; // defined in the route by specifying ":userID"    // present UI for viewing user with ID 'userID'    return YES; // return YES to say we have handled the route  }];  // ...  return YES;}- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {  return [JLRoutes routeURL:url];}

转载地址:https://blog.csdn.net/weixin_34406061/article/details/86080674 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Linux Linux程序练习十九
下一篇:jquery筛选器

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月23日 10时51分44秒