This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
View controller visit proposal extensions (#55)
* Add view controller as a first-citizen in visit proposal * Rename identification protocol * Extend VisitableViewController so we can return a default value for view controller * Add documentation to view controller property and PathConfigurationIdentifiable * Update read me * Add best practice on identifier * Update README.md Formatting * Documentation tweaks * Code formatting --------- Co-authored-by: Joe Masilotti <[email protected]>
- Loading branch information
1 parent
d980904
commit 159a2ef
Showing
4 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import UIKit | ||
|
||
/// As a convenience, your view controller may conform to `PathConfigurationIdentifiable`. | ||
/// You may then use the view controller's `pathConfigurationIdentifier` property instead of `proposal.url` when deciding how to handle a proposal. See `VisitProposal.viewController` on how to use this in your configuration file. | ||
/// | ||
/// ``` | ||
/// func handle(proposal: VisitProposal) -> ProposalResult { | ||
/// switch proposal.viewController { | ||
/// case RecipeViewController.pathConfigurationIdentifier: | ||
/// return .accept(RecipeViewController.new) | ||
/// default: | ||
/// return .accept | ||
/// } | ||
/// } | ||
/// ``` | ||
public protocol PathConfigurationIdentifiable: UIViewController { | ||
static var pathConfigurationIdentifier: String { get } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Turbo | ||
|
||
extension VisitableViewController: PathConfigurationIdentifiable { | ||
public static var pathConfigurationIdentifier: String { "web" } | ||
} |