Questions tagged [draggesture]
61 questions
1
vote
1 answer
ScrollView limits DragGesture animation
I have HStack with some images shown via ForEach view. Each image has DragGesture applied. I can drag an image all over the screen and the animation shown correctly. But when I put my HStack with images into the ScrollView when I drag an image (not…

Leo
- 37
- 6
1
vote
0 answers
swiftUI I want to process my app in the background (background proccessing)
I always want to get the x and y coordinate touched of my fingertip.
For example, I also want to get the coordinates when using another app. So I want to process the code below in the background.
It seems good to use background processing in…

Ken
- 11
- 1
1
vote
2 answers
How to restrict Drag/Pan of a View between 2 CGPoints (Like a Slider)
I have 2 independent set of data, one is used to draw a line(a Path), and the other is used to put a small view somewhere on the line(Circle).
You can imagine it just like a Slider(in fact the UX should be something like that)
I wanted to add a…

Pulkit Vaid
- 103
- 1
- 8
1
vote
1 answer
SwiftUI DragGestures not updating until different DragGesture triggered
this gif should pretty clearly show my issue.
In words, I have a DragGesture for the background color, and TapGesture to add Text() views. Each Text View has a DragGesture on it to update its location as its dragged.
This works, but the visually…

cmweeden
- 165
- 1
- 1
- 7
0
votes
0 answers
How can I use a drag gesture to shrink a view down to its 'compact' size in SwiftUI?
I have a View that has similar properties to this and I am trying to create a gesture so the user can drag it down to make it compact:
struct myView: View {
@State var isCompact = false
var body: some View {
Text("")
…

Halpo
- 2,982
- 3
- 25
- 54
0
votes
0 answers
SwiftUI Drag Gesture Cancel State
I made a view to drag left and right in SwiftUI. This is working fine but having an issue when dragging quickly.
I made a Tinder like swipe in my SwiftUI app. When I tries to quickly drag the view left and right the view stucks there. I am attaching…

Taimoor Arif
- 750
- 3
- 19
0
votes
1 answer
SwiftUI: Hiding tabBar and navigationBar on scroll
I have a complex view that includes a ScrollView and I'm trying to hide both the tabBar and the navigationBar whenever the user starts scrolling, and show them again when the user stops scrolling (kind of like in the Apollo iOS for Reddit…

noloman
- 11,411
- 20
- 82
- 129
0
votes
0 answers
Cannot make press(forDuration:, thenDragTo:) work correctly
I have a SwiftUI app that allows to drag pins on a map.
A pin is first long pressed. On ended, the pin is moved upwards so that its base can be seen. It can then be dragged.
I want to write a UI test that checks correct operation.
However my test…

Reinhard Männer
- 14,022
- 5
- 54
- 116
0
votes
0 answers
rotating dial with finger movements not dragging smoothly - SwiftUI
I'm creating rotating dial using SwiftUI with drag gesture so that user can rotate dial with finger movements smoothly but i don't know why it is not working smoothly when user start dragging second time. You can check gif and code below. Any…

Kishan Bhatiya
- 2,175
- 8
- 14
0
votes
0 answers
Constrain View while using DragGesture in SwiftUI
I am currently building a BeReal clone and I am working on the small picture you can drag across the screen.
Rectangle Code (Placeholder for small image)
Rectangle()
.frame(width: UIScreen.main.bounds.width * 0.33,
height:…

memexanti
- 1
- 1
0
votes
0 answers
How can I set the drag gesture within the bounds of a selected image
I am doing some tests where someone can select an image from their photo gallery . Once they select an image there will be a text in the center of the image "Sample test" I want that text to be draggable within the bounds of the image selected . I…

user1591668
- 2,591
- 5
- 41
- 84
0
votes
0 answers
Inconsistently able to trigger a SwipeAction when there is a DragGesture on a parent view
The problem I'm facing is with competing gestures.
There's a DragGesture on the parent view to allow the user to return to the previous screen.
Then theres a list, which is a child view, that has a swipeAction for its own child views.
These two…

Santana_says
- 1
- 1
0
votes
0 answers
SwiftUI DragGesture list content Leaks memory
I am trying to implement Uber trip like screen, and I have used the code below
public struct OverlappingPanView: View
where BGView: View, PanContentView: View {
public var backgroundView: () -> BGView
public var…

AlbinMrngStar
- 289
- 2
- 13
0
votes
0 answers
Is there a way to save the offset of a shape after a drag gesture in SwiftUI?
Good morning Everyone,
I'm building an app that allows to create and add “tables”(rectangles) to a floor plan of a restaurant. I would like to know if there is a way in SwiftUI to save the position of every ”table” that the user creates before and…
0
votes
1 answer
SwiftUI disable tap gesture on buttons while Dragging
I have a "caroussel view", that has different "cards" in it, with buttons.
I want to disable the buttons while user dragging the caroussel view.
....
HStack(alignment: .center, spacing: spacing) {
ForEach(cards.indices, id:…

Marta Paniti
- 152
- 6