Linked Questions

0 votes
1 answer
2k views

SwiftUI -- Button to go to Home Screen in app [duplicate]

I'm trying to make a small button on the top right corner of my app that will allow the user to return to the "Home Screen" of my application. Here's what my app looks like Launch Screen --&...
codegeek321's user avatar
0 votes
1 answer
892 views

I want to move to the first screen with NavigationLink in SwiftUI [duplicate]

The screen transitions with NavigationLink. I want to return to the first screen by clicking the button on the third screen. How do you do it? The following code returns from the third screen to the ...
Ika's user avatar
  • 1,843
172 votes
11 answers
133k views

How to pop or dismiss a view programmatically

I couldn't find any reference about any ways to make a pop or a dismiss programmatically of my presented view with SwiftUI. Seems to me that the only way is to use the already integrated slide dow ...
Andre's user avatar
  • 7,758
92 votes
17 answers
81k views

SwiftUI dismiss modal

Since SwiftUI is declarative there is no dismiss method. How can is add a dismiss/close button to the DetailView? struct DetailView: View { var body: some View { Text("Detail") } } ...
Ugo Arangino's user avatar
  • 2,946
15 votes
4 answers
13k views

SwiftUI ToolbarItem doesn't present a View from a NavigationLink

I don't know if this is a bug or I am doing something wrong here. I've added a new button on the Navigation bar that would present a new view. struct MyView: View { @ObservedObject var viewModel =...
user avatar
8 votes
1 answer
4k views

NavigationStack not affected by EnvironmentObject changes

I'm attempting to use @EnvironmentObject to pass an @Published navigation path into a SwiftUI NavigationStack using a simple wrapper ObservableObject, and the code builds without issue, but working ...
Collin Allen's user avatar
  • 4,595
8 votes
2 answers
4k views

Completely move to other view and don't allow to go back in SwiftUI

I'm developing a simple iOS app with SwiftUI with two views: a LogInView() and a HomeView(). What I want is really simple: when the user clicks on the Login Button on LogInView() I want the app to ...
amodrono's user avatar
  • 2,038
9 votes
2 answers
9k views

Remove screen from navigation stack in SwiftUI

I'm using NavigationLink to navigate screens in NavigationView. How can I remove screen from navigation stack? Not just hide the navigation "Back" button but completely remove screen from ...
badadin's user avatar
  • 577
1 vote
1 answer
2k views

SwiftUI: NavigationLink pops back when variable is updated

I have this issue where the navigation link pops back when a variable is updated. It's a bit confusing because this behavior doesn't occur elsewhere in the application, but I am doing the same thing. ...
Joseph Kessler's user avatar
8 votes
1 answer
5k views

Come back to a specific View in SwiftUI (popToViewController)

Is it possible in SwiftUI to come back to a specific view? Let's say I have three views this way: struct View1: View { var body: some View { NavigationView { VStack { ...
superpuccio's user avatar
  • 13.2k
7 votes
2 answers
6k views

SwiftUI: How to switch to a new navigation stack with NavigationViews

I am currently using SwiftUI Beta 5. I have a workflow which involves navigating through a series of views. The last view involves an operation which populates a load of data into the app and ends ...
Andy Thomas's user avatar
  • 1,367
1 vote
3 answers
8k views

SwiftUI Clear Navigation Stack

In my iOS 14 SwiftUI app, when user is not logged in, I make him go through a few setup screens before presenting the main logged in screen. At the last setup screen, I use a NavigationLink to present ...
Raj Chaudhary's user avatar
3 votes
3 answers
4k views

SwiftUI - How you can pop to specific view in SwiftUI?

Is there some way to implement popToViewController(vc) equivalent in SwiftUI? For example if I have the following flow: View1 -> View2 -> View3 -> View4 How can I pop from View4 directly to View2 ...
Milen Valchev's user avatar
3 votes
1 answer
3k views

How to dismiss sheet from within NavigationLink

In the following example, I have a view that shows a sheet of ViewOne. ViewOne has a NavigationLink to ViewTwo. How can I dismiss the sheet from ViewTwo? Using presentationMode.wrappedValue.dismiss() ...
Isaak's user avatar
  • 1,379
0 votes
1 answer
2k views

NavigationStack iOS16 with Route, how to pop back to root?

I have the following navigation stack using route to go to differnet views: import SwiftUI import FirebaseAuth import WebKit enum Route:String, Hashable { case linkSettings, linkWallet } ...
Pro Girl's user avatar
  • 982

15 30 50 per page