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

Answered by ssmith_c in 787092022

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") }
            })

    }
}
Accepted Answer

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

Details panel catching show/hide
 
 
Q