Skip to content

Commit

Permalink
Remove "required" from VisitableViewController
Browse files Browse the repository at this point in the history
  • Loading branch information
joemasilotti committed Dec 13, 2023
1 parent 1d573f0 commit b275149
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Turbo Navigator/TurboNavigator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class TurboNavigator {
private func controller(for proposal: VisitProposal) -> UIViewController? {
switch delegate.handle(proposal: proposal) {
case .accept:
Turbo.config.defaultViewController.self.init(url: proposal.url)
Turbo.config.defaultViewController(proposal.url)
case .acceptCustom(let customViewController):
customViewController
case .reject:
Expand Down
4 changes: 3 additions & 1 deletion Source/Turbo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public class TurboConfig {

/// The view controller used in `TurboNavigator` for web requests. Must be
/// a `VisitableViewController` or subclass.
public var defaultViewController = VisitableViewController.self
public var defaultViewController: (URL) -> VisitableViewController = { url in
VisitableViewController(url: url)
}

/// Optionally customize the web views used by each Turbo Session.
/// Ensure you return a new instance each time.
Expand Down
2 changes: 1 addition & 1 deletion Source/Visitable/VisitableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open class VisitableViewController: UIViewController, Visitable {
open weak var visitableDelegate: VisitableDelegate?
open var visitableURL: URL!

public required convenience init(url: URL) {
public convenience init(url: URL) {
self.init()
self.visitableURL = url
}
Expand Down

0 comments on commit b275149

Please sign in to comment.