What is the alternative for SwiftUI of UIKit's "pushViewController" in a barButtonItem

In SwiftUI you use a NavigationButton to navigate your app.

Just replace your PresentationButton with a NavigationButton:

.navigationBarItems(trailing:
    NavigationButton(destination: DetailVC()) {
        Image(systemName: "plus")
            .resizable()
            .frame(width: 20, height: 20)
    }
)

Apple Docs:

https://developer.apple.com/documentation/swiftui/navigationbutton (deprecated)

EDIT:


The NavigationButton was deprecated, so it should no longer be used.

Instead there is a NavigationLink view, which should work. This struct is new and I wasn't able to test it yet but the code for the button itself should look like this:

NavigationLink(destination: DetailVC()) { }

Apple Docs:

https://developer.apple.com/documentation/swiftui/navigationlink