File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change 9
9
![ CocoaPods] ( https://img.shields.io/badge/CocoaPods-supported-brightgreen.svg )
10
10
[ ![ License] ( http://img.shields.io/badge/license-MIT-lightgrey.svg?style=flat )] ( http://mit-license.org )
11
11
12
+
13
+
14
+ ## 迁移至[ Khala] ( https://github.com/linhay/Khala )
15
+
16
+ 1 . ##### 安装[ Khala] ( https://github.com/linhay/Khala )
17
+
18
+ ```
19
+ pod 'Khala'
20
+ ```
21
+
22
+ 2 . ##### 添加路由规则
23
+
24
+ ``` swift
25
+ // 路由规则
26
+ Khala.language = .cn
27
+ Khala.rewrite .filters .append (RewriteFilter ({ (item) -> KhalaURLValue in
28
+ var urlComponents = URLComponents (url : item.url , resolvingAgainstBaseURL : true )
29
+ urlComponents? .host = " Router_" + (item.url .host ?? " " )
30
+ urlComponents? .path = " /router_" + item.url .lastPathComponent
31
+ item.url = urlComponents? .url ?? item.url
32
+ return item
33
+ }))
34
+ ```
35
+
36
+ 3 . ##### 修改路由函数
37
+
38
+ 第一个参数修改为匿名.
39
+
40
+ from:
41
+
42
+ ```
43
+ @objc func router_location(params: [String:Any],closure: (_ info: [String:Any]) -> Void){
44
+ ...
45
+ }
46
+ ```
47
+
48
+ to:
49
+
50
+ ``` swift
51
+ @objc func router_location (_ params : [String :Any ],closure : @escaping KhalaClosure){
52
+ ...
53
+ }
54
+ ```
55
+
56
+ 4 . #### 完了.
57
+
12
58
## Require
13
59
14
60
- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
You can’t perform that action at this time.
0 commit comments