From e49c897bac7ceffcab8768863888164a9529c311 Mon Sep 17 00:00:00 2001 From: Fernando Olivares Date: Thu, 16 Nov 2023 11:18:33 -0600 Subject: [PATCH] NumbersViewController should conform to PathConfigurationIdentifiable --- Demo/NumbersViewController.swift | 5 ++++- Demo/SceneController.swift | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Demo/NumbersViewController.swift b/Demo/NumbersViewController.swift index 4a637ee..2a30d00 100644 --- a/Demo/NumbersViewController.swift +++ b/Demo/NumbersViewController.swift @@ -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 diff --git a/Demo/SceneController.swift b/Demo/SceneController.swift index 9fc1236..078358b 100644 --- a/Demo/SceneController.swift +++ b/Demo/SceneController.swift @@ -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)) }