Details panel catching show/hide

Hi,

How to catch the event when details panel of a SplitView shows and get hidden, like when split is 2 columns and when its details only ?

Kindest Regards

Accepted Reply

attach .onAppear to the contents of your details, kinda like this minimal example

struct ContentView: View {
    var body: some View {
        NavigationSplitView(
            sidebar: {
                Text("Sidebar")
            },
            detail: {
                Text("detail")
                    .onAppear { print("details appeared") }
            })

    }
}

Replies

attach .onAppear to the contents of your details, kinda like this minimal example

struct ContentView: View {
    var body: some View {
        NavigationSplitView(
            sidebar: {
                Text("Sidebar")
            },
            detail: {
                Text("detail")
                    .onAppear { print("details appeared") }
            })

    }
}

Thanks allot