File tree Expand file tree Collapse file tree
Examples/SingleNavigator/02-SingleEventSubscriber/SingleEventSubscriber/DeepLink
Sources/LinkNavigator/Core/BaseComponent Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Foundation
22import LinkNavigator
3+ import URLEncodedForm
34
45enum 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}
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments