Questions tagged [draggesture]
61 questions
0
votes
1 answer
SwiftUI DragGesture weird jump up behavior
I have created a bottom card with a drag gesture that is not yet finished. But I ran into an issue when I set the default translation height from zero and it just jumps to what I think is translation 0.
import SwiftUI
struct…

Ash
- 81
- 9
0
votes
0 answers
Using SwiftUI DragGesture to scale down and remove the whole view but lead to infinity loop
I want to implement the animation like AppStore. Drag down detail page to scale down and remove itself view.
But when I started to drag, the console keeps printing var scale is changing and app is freezes. Looks like go into infinity loop. Here is…

miclendor
- 65
- 1
- 9
0
votes
0 answers
Delay DragGesture after drag
Currently, I'm building a card swipe view similar like tinder. I also want to add a slight delay between the swipes, that the user can't swipe fast through the cards. The delay should be one second. However, this is not working as I want. Basically,…

adri567
- 533
- 5
- 20
0
votes
1 answer
Detect single/multi-finger gesture Swiftui
How to detect number of finger interaction with Gesture in SwiftUI Gesture. With UIKit we can find number of find it from
let numberOfTouches = panGestureRecognizer.numberOfTouches
Any thought?

Santosh Singh
- 765
- 11
- 27
0
votes
0 answers
SwiftUI View Overlap when integrated with Drag gesture
I am new to swiftUI and facing an issue when working with DragGesture functionality of view. I am trying to create a photo gallery app which have swipe functionality. Facing an issue with having a gesture view embedded in HStack with other 2 views.…

Shree
- 1
- 2
0
votes
1 answer
Wrong geometry drag coordinates
I'm trying to drag the gray square inside the white square manteinig the starting point CGPoint(x: 0, y: 0) and respecting the extreme coordinates, see of the image.
The code works but I have two problems:
the mouse doesn't match the center of the…

Joannes
- 2,569
- 3
- 17
- 39
0
votes
1 answer
Rotation of view goes backwards with drag gesture
I have a view that I want to be able to drag around - kind of like a non-free spinning wheel of fortune. The dragging works fine on the y axis and at the bottom of the wheel, but with the x - the view rotates in the wrong direction when dragging the…

HillInHarwich
- 441
- 6
- 25
0
votes
1 answer
How to rotate an 3D model using DragGesture in Android SceneForm
I followed the solution here for rotating a TransformableNode on the X axis based on the user's DragGesture, using the Sceneform Android SDK. However, I would also like to rotate on the Y and Z axis as well, similar to how ARCore SceneViewer does…

VIN
- 6,385
- 7
- 38
- 77
0
votes
1 answer
I try to create a Button with Drag Gesture like the bubble messenger of android
I created an Image with Drag gesture, but when I convert it to a Button, full screen become the button, so when I click to anywhere in the screen, the Button will be action
struct OwlFly: View {
private var bround = UIScreen.main.bounds
…

Horitsu Potter
- 107
- 1
- 6
0
votes
0 answers
SwiftUI: how do I drag multiple items separately with the onDrag gesture?
So I've been playing around in Xcode. And I have a question.
The problem is that when I use the dragGesture and I put multiple items (in this case Rectangles) on the screen, all of them move when I want to just move one item.
I want to move all the…

Curiousnoes
- 83
- 8
0
votes
1 answer
How can I use partial DragGesture for my side menu
I'm trying to use the DragGesture for my side menu. Currently, the DragGesture is using the entire screen, and I'd like to use it only from the left to right as shown in the screenshot (gray area):
My code snippet:
@State var width =…

jnrkane
- 1
0
votes
1 answer
SwiftUI DragGesture inconsistencies with location and start location
I'm building a SwiftUI macOS app.
I've got a basic Rectangle shape with a drag gesture on it.
In the onEnded handler, I am wanting to determine if the user has effectively tapped on the object. I do this by checking that the width and height of the…

Chris
- 7,996
- 11
- 66
- 98
0
votes
2 answers
Modify view inside a ForEach in SwiftUI
I tried to update the position of one item of a ForEach. I want to drag only one item out of the array in the ForEach. The rest should stay the same. I tried several different ways and the outcome was always that all items where dragged or no item…

phlpp77
- 45
- 6
0
votes
1 answer
View is re-initialized after DragGesture onChanged
The following code shows an orange screen with a green circle in the lower right. The circle can be dragged.
import SwiftUI
struct DraggableCircle: View {
@Binding var offset: CGSize
@State private var previousOffset: CGSize
var body:…

Bart van Kuik
- 4,704
- 1
- 33
- 57
-2
votes
1 answer
Check if a drag value is increasing or decreasing in Swiftui
How can I check if the drag value is increasing or decrease when dragging up or down. I want to know the direction someone is dragging in. Can anyone help with this??

TheManOfSteell
- 105
- 9