Post

Replies

Boosts

Views

Activity

Reply to Custom back button with SwiftUI
Right now there's no simple way to do this. Here's a somewhat hackey solution. create a GestureState at the top of your view @GestureState private var dragOffset = CGSize.zero then add this to whatever you want to enable swipe-to-go-back functionality on! Group { Text("The entire View I want to enable swipe-to-go-back functionality on") } .gesture(DragGesture().updating($dragOffset, body: { (value, state, transaction) in &#9;&#9; if(value.startLocation.x < 20 && value.translation.width > 100) { &#9;&#9;&#9;&#9; self.presentationMode.wrappedValue.dismiss() &#9;&#9; } }) good luck!
Oct ’20