Last active
November 18, 2023 02:27
-
-
Save zats/818bf4d73d99077fb08f82c20d208d16 to your computer and use it in GitHub Desktop.
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
// ... | |
Button("Submit") { | |
navigationController.navigate(to: .search(searchText, postType: .all, searchType: .advanced)) | |
} | |
// ... |
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
struct RootView: View { | |
// ... | |
@ObservedObject var navigationController = NavigationController() | |
var body: View { | |
NavigationStack(path: $navigationController.path) { | |
InitialView() | |
.navigationDestination(for: AppNavigationTarget.self) { target in | |
switch target { | |
case let .related(toPost, showOriginal, postType): | |
RelatedView( | |
post: toPost, | |
showOriginal: showOriginal, | |
postType: postType, | |
navigationController: navigationController | |
) | |
// .... | |
// navigationController can also be an Environment set variable | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment