-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send in $destination into Adapter #8
base: main
Are you sure you want to change the base?
Conversation
…as been cleared, and can clear its own state.
I like this idea but I also have another suggestion for dealing with navigations that may be useful: 1. Start by creating protocols for navigation actions(This could be a file named import DomainModels
public protocol DetailsNavigation {
func navigateToCountryDetails(country: Country)
}
public protocol AboutThisAppNavigation {
func navigateToAboutThisApp()
} 2. Make the app's navigator conform to the protocolsextension TravelAdvisoriesNavHost: DetailsNavigation, AboutThisAppNavigation {
public func navigateToCountryDetails(country: Country) {
self.destination = Destinations.details(regionCode: country.regionCode)
}
public func navigateToAboutThisApp() {
self.destination = Destinations.aboutThisApp
}
} 3. Update
|
|
||
import Foundation | ||
|
||
public enum Destinations { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe naming this enum singular (instead of plural) would eliminate any confusion when expecting parameters of this type:
// 👍
func navigateTo(destination: Destination) { ... }
// ❓
func navigateTo(destination: Destinations) { ... } // it feels like we are going to navigate to multiple places
So it knows when the destination has been cleared, and can clear its own state.