Repository navigation
Replies: 1 comment 2 replies
|
Hi @jspooner, You're right! Passing the navigator into your native view is the typical approach. It lets you call There's actually an official example of this in the demo app that follows this pattern: func handle(proposal: VisitProposal, from navigator: Navigator) -> ProposalResult {
switch proposal.viewController {
case NumbersViewController.pathConfigurationIdentifier:
return .acceptCustom(NumbersViewController(
url: proposal.url,
navigator: navigator
)
)
default:
return .accept
}
}final class NumbersViewController: UITableViewController, PathConfigurationIdentifiable {
static var pathConfigurationIdentifier: String { "numbers" }
init(url: URL, navigator: NavigationHandler) {
self.url = url
self.navigator = navigator
super.init(nibName: nil, bundle: nil)
}
...
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let detailURL = url.appendingPathComponent("\(indexPath.row + 1)")
// Navigate from the native view controller back to Rails
navigator?.route(detailURL)
tableView.deselectRow(at: indexPath, animated: true)
}
} |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We’ve created a native index page for
/hikesto display a native list. How do we link from this page to our Rails HTML pages at/hikes/:id?It seems the handle function in NavigatorDelegate could pass a reference to the navigator to the native page, allowing it to call
navigator.route(VisitProposal). Is this the recommended approach?All reactions