Skip to content

Commit

Permalink
NumbersViewController should conform to PathConfigurationIdentifiable
Browse files Browse the repository at this point in the history
  • Loading branch information
olivaresf committed Nov 16, 2023
1 parent 8ec5b89 commit e49c897
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Demo/NumbersViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import UIKit

/// A simple native table view controller to demonstrate loading non-Turbo screens
/// for a visit proposal
final class NumbersViewController: UITableViewController {
final class NumbersViewController: UITableViewController, PathConfigurationIdentifiable {

static var pathConfigurationIdentifier: String { "numbers" }

convenience init(url: URL, navigator: Navigator) {
self.init(nibName: nil, bundle: nil)
self.url = url
Expand Down
5 changes: 4 additions & 1 deletion Demo/SceneController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ extension SceneController: UIWindowSceneDelegate {
extension SceneController: TurboNavigatorDelegate {
func handle(proposal: VisitProposal) -> ProposalResult {
switch proposal.viewController {
case "numbers":

case NumbersViewController.pathConfigurationIdentifier:
return .acceptCustom(NumbersViewController(url: proposal.url, navigator: navigator))

case "numbersDetail":
let alertController = UIAlertController(title: "Number", message: "\(proposal.url.lastPathComponent)", preferredStyle: .alert)
alertController.addAction(.init(title: "OK", style: .default, handler: nil))
return .acceptCustom(alertController)

default:
return .acceptCustom(TurboWebViewController(url: proposal.url))
}
Expand Down

0 comments on commit e49c897

Please sign in to comment.