Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bundle parameter to route #207

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Source/Turbo Navigator/TurboNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ public class TurboNavigator {
/// Convenience function to routing a proposal directly.
///
/// - Parameter url: the URL to visit
public func route(_ url: URL) {
/// - Parameter parameters: provide context relevant to `url`
public func route(_ url: URL, parameters: [String: Any]? = nil) {
let options = VisitOptions(action: .advance, response: nil)
let properties = session.pathConfiguration?.properties(for: url) ?? PathProperties()
route(VisitProposal(url: url, options: options, properties: properties))
route(VisitProposal(url: url, options: options, properties: properties, parameters: parameters))
}

/// Transforms `VisitProposal` -> `UIViewController`
Expand Down
7 changes: 6 additions & 1 deletion Source/Visit/VisitProposal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ public struct VisitProposal {
public let url: URL
public let options: VisitOptions
public let properties: PathProperties
public let parameters: [String: Any]?

public init(url: URL, options: VisitOptions, properties: PathProperties = [:]) {
public init(url: URL,
options: VisitOptions,
properties: PathProperties = [:],
parameters: [String: Any]? = nil) {
self.url = url
self.options = options
self.properties = properties
self.parameters = parameters
}
}