URLRewriter
介绍
使用正则表达式规则,修改任意字符串。
pattern:
^(?:https?:)\\/\\/test.(com|test)\\/product\\/([0-9]*).html$
target:
myappScheme://host.mobile/goodsDetail?goodsId=$2
input:
http://test.com/product/2345.html
如上,可以将input通过动态配置的pattern改写成target。
示例
let rule = RewriteRule(pattern: "^(?:https?:)\\/\\/test.(com|test)\\/product\\/([0-9]*).html$", target: "myappScheme://host.mobile/goodsDetail?goodsId=$2")
URLRewriter.instance
要求
安装
URLRewriter 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'URLRewriter'
作者
chinabrant, [email protected]
许可证
URLRewriter可在MIT许可下使用。更多信息请参阅LICENSE文件。