Skip to content

Commit

Permalink
Expose a route function with a VisitProposal param
Browse files Browse the repository at this point in the history
  • Loading branch information
joemasilotti committed Nov 15, 2023
1 parent 6443d9a commit e455709
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Turbo Navigator/TurboNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,20 @@ public class TurboNavigator {
}

/// Transforms `URL` -> `VisitProposal` -> `UIViewController`.
/// Given the `VisitProposal`'s properties, push or present this view controller.
/// Convenience function to routing a proposal directly.
///
/// - Parameter url: the URL to visit.
/// - Parameter url: the URL to visit
public func route(_ url: URL) {
let options = VisitOptions(action: .advance, response: nil)
let properties = session.pathConfiguration?.properties(for: url) ?? PathProperties()
let proposal = VisitProposal(url: url, options: options, properties: properties)
route(VisitProposal(url: url, options: options, properties: properties))
}

/// Transforms `VisitProposal` -> `UIViewController`
/// Given the `VisitProposal`'s properties, push or present this view controller.
///
/// - Parameter proposal: the proposal to visit
public func route(_ proposal: VisitProposal) {
guard let controller = controller(for: proposal) else { return }
hierarchyController.route(controller: controller, proposal: proposal)
}
Expand Down

0 comments on commit e455709

Please sign in to comment.