navigation

macOS SwiftUI Navigation for a Single View

泪湿孤枕 提交于 2020-11-27 12:24:22
问题 I'm attempting to create a settings view for my macOS SwiftUI status bar app. My implementation so far has been using a NavigationView , and NavigationLink , but this solution produces a half view as the settings view pushes the parent view to the side. Screenshot and code example below. Screenshot - Navigation Sidebar struct ContentView: View { var body: some View { VStack{ NavigationView{ NavigationLink(destination: SecondView()){ Text("Go to next view") }} }.frame(width: 800, height: 600,

Navigation Component: pass safeArgs from activity to a fragment

北城余情 提交于 2020-11-27 05:05:51
问题 I have two graphs, so the first graph move from one fragment to an activity passing safeArgs to the activity. val action = MyFragmentDirections.actionMyActivity(arg1, arg2) Navigation.findNavController(view).navigate(action) Now in the second, I want to pass these arguments from MyActivity to a fragment which belongs to this activity. I can get the args: val args = MyActivity.fromBundle(intent.extras) The problem is there is not a Directions file for this activity, so I can't pass the

Navigation Component: pass safeArgs from activity to a fragment

こ雲淡風輕ζ 提交于 2020-11-27 05:02:53
问题 I have two graphs, so the first graph move from one fragment to an activity passing safeArgs to the activity. val action = MyFragmentDirections.actionMyActivity(arg1, arg2) Navigation.findNavController(view).navigate(action) Now in the second, I want to pass these arguments from MyActivity to a fragment which belongs to this activity. I can get the args: val args = MyActivity.fromBundle(intent.extras) The problem is there is not a Directions file for this activity, so I can't pass the