如何在 SwiftUI 中调用 api 后推送到导航堆栈中的下一个视图?

How to push to next view in the Navigation stack after the api call in SwiftUI?

我有一个 NavigationView,在 api 调用之后我需要推送到 nextView(我不想使用 ZStack,因为我应该能够在此之后执行推送和弹出操作)。

在我的例子中,我使用 NavigationLink(destination: YourNextView(), isActive: Binding) 来实现我理想的申请流程。使用 NavigationLink(destination: ,isActive:) 后,我仍然可以使用 Alert 或 Popover。因此,我认为你可以试试这个。 Click here for more information about NavigationLink