Ask Your Question
3

What is the method for displaying NavigationLink inside a DisclosedGroup in SwiftUI?

asked 2023-06-27 07:46:12 +0000

lakamha gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-27 08:03:02 +0000

bukephalos gravatar image

Here's an example code snippet for displaying NavigationLink inside a DisclosedGroup in SwiftUI:

struct ContentView: View {
    var body: some View {
        List {
            DisclosedGroup("Group") {
                NavigationLink("Item 1", destination: Text("Item 1 Details"))
                NavigationLink("Item 2", destination: Text("Item 2 Details"))
                NavigationLink("Item 3", destination: Text("Item 3 Details"))
            }
        }
    }
}

In this example, we have a List and inside it, we have a DisclosedGroup with the label "Group". Inside the DisclosedGroup, we have three NavigationLinks that will navigate to different destinations when tapped.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-27 07:46:12 +0000

Seen: 12 times

Last updated: Jun 27 '23