I have a case where one of my SwiftUI Views is automatically going back to previous screen on a published variable change, which is not related to isActive. I want to stop navigating the swiftUI view onViewWillDisappear(). How can I stop SwiftUI from navigating just before it is navigating.
Related
I am trying to create the same experience where a sheet is presented in one of the tab items of a TabView - not covering the tabs.
I am using .presentationDetents() and SwiftUI4.0 for that.
See example of Apple's own app doing that
The sheet is covering the child view inside TabView.
However, instead in my own code I am getting
this - the tabs of the parent view are covered by the modal sheet
The link https://developer.apple.com/forums/thread/711702 suggests that it is not possible to achieve the same behaviour you see in Apple's Maps and Find My apps with the current SwiftUI API.
I want to go from one view to another with the click of a button. Like if I press Log In, it goes to the "Home" view.
I tried to use NavigationLink, but it needs a NavigationView, which I don't want to do because it messes with the format of the app on macOS. What is an alternative to NavigationLink to get from one view to another?
I have a SwiftUI puzzle game. I store played puzzles and show in the history view. History view is displayed as a sheet when a button is tapped. In the history view, I want to have a button ("Replay puzzle") which should 1) dismiss the history view, and 2) run a function in the main view so that a game from history view can be replayed.
Seems simple but I could not figure out how to call a function in the main view to update the current game. Any pointers would be appreciated.
Use onDismiss parameter of .sheet, like in https://stackoverflow.com/a/63673342/12299030
SwiftUI can easily present a sheet view on top of the existing review when a condition is met (see screen record below). What is the sheet component equivalent in UIKit?
Tried to Google a result and it looks like there is a sheet related view called UIActionSheet, but that does not seem like the right UI control.
REFERENCE
Example of how to achieve the same behavior with UIKit.
iOS 14 navigation bar title is not displayed in UINavigationController created programmatically
This is just another UIViewController presented modally with a Done UIBarButtonItem on the right side.
Unlike in UIKit, where a LongPressGesture is actually delayed, in SwiftUI it began as soon as you hover/pan/touch the view. So if you have a LongPressGesture/Action in a View within a List or a NavigationLink, it'll prevent scrolling the List, or triggering the NavigationLink action.
Anyone have any idea if it's possible to delay it with current API?