Skip to content

Commit d13f1eb

Browse files
committed
fix: connected deeplink item
1 parent ad468ab commit d13f1eb

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

Examples/SingleNavigator/02-SingleEventSubscriber/SingleEventSubscriber/DeepLink/DeepLinkParser.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Foundation
22
import LinkNavigator
3+
import URLEncodedForm
34

45
enum DeepLinkParser {
56
static func parse(url: URL, completeAction: @escaping (LinkItem?) -> Void) {
@@ -9,7 +10,7 @@ enum DeepLinkParser {
910
}
1011

1112
let pathList = component.path.split(separator: "/").map(String.init)
12-
let item: String = component.query ?? ""
13+
let item = try? URLEncodedFormDecoder().decode(HomeToPage1Item.self, from: component.query ?? "")
1314
completeAction(.init(pathList: pathList, items: item))
1415
}
1516
}

Sources/LinkNavigator/Core/BaseComponent/LinkItem.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ public struct LinkItem {
2929
encodedItemString = items
3030
}
3131

32-
public init(path: String, items: Codable) {
32+
public init(path: String, items: Codable?) {
3333
pathList = [path]
34-
encodedItemString = items.encoded()
34+
encodedItemString = items?.encoded() ?? ""
3535
}
3636

37-
public init(pathList: [String], items: Codable) {
37+
public init(pathList: [String], items: Codable?) {
3838
self.pathList = pathList
39-
encodedItemString = items.encoded()
39+
encodedItemString = items?.encoded() ?? ""
4040
}
4141

4242
// MARK: Internal

0 commit comments

Comments
 (0)