Send in $destination into Adapter#8
Send in $destination into Adapter#8Eric Silverberg (esilverberg) wants to merge 1 commit intomainfrom
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.
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.