Swift • How to implement Peek and Pop Functionality in SwiftUI?

Viewed 326

I am currently trying to implement Peek and Pop Functionality to my App.

Here is my Code so far:

NavigationView(destination: DetailView()) {
    Text("Check out the Detail View")
}
.contextMenu {
    Button(action: { // ... }) {
        Text("Option 1")
    }
    Button(action: { // ... }) {
        Text("Option 1")
    }
}

When long-pressing the View now, the Context Menu appears with the two Options.

However, I also would like to present a Preview of the Detail View above the Options. How can I achieve this in SwiftUI?


This is an example of the final Goal:

Example

0 Answers
Related