Questions tagged [swiftui-ontapgesture]

49 questions
1
vote
1 answer

How to use ScrollViewReader in two List from two different api (without Button\TextField) using .onTapGesture in SwiftUI?

I have project, where two list of different banks show currency rate. And I want when I choose currency in first List, second List will have autoscrolling to the same currency. I saw tutorials with buttons, but it's not what I need. I thought use…
1
vote
0 answers

SwiftUI - onTapGesture on HStack works, until it stops working

We have a custom view, that we use in forms (its main feature is to be able to show a nice border on if there is a validation error on the form): struct ButtonNavigationLink: View { var label: String var markingType: MarkingType = .none …
memical
  • 2,353
  • 1
  • 24
  • 36
0
votes
0 answers

How to use onTapGesture and onLongPressGesture simultaneously in SwiftUI

I'm trying to create a function where the number increases by +1 when the button is tapped, and when the button is held down, the number continues to increase only while the button is pressed. To create this functionality, I'm trying to use both…
0
votes
1 answer

Tap Gesture in GridRow doesn't work in empty spaces

I'm making a table with Grid like the one I'm showing in the screenshot. (Picture link) Everything is fine except the onTapGesture won't be trigger if the user taps in a place there is not text or there is not image. If the user taps in the image or…
xarly
  • 2,054
  • 4
  • 24
  • 40
0
votes
1 answer

SwiftUI dynamic list of Button

I created a view showing a list of Button. These buttons are displaying a date. This view is instantiated in my HomeView. My need is that whenever the user taps one of the button, the date displayed by the tapped button is stored to a variable. Only…
0
votes
0 answers

OnTapGesture ALWAYS registers out of frame or view

I'm new to Swift, trying to do a personal project and I currently am stuck at a thing for which I cannot find a resolution anywhere for the past week. This is the code: import SwiftUI struct MainStatsView: View { var stat: StatElements …
0
votes
1 answer

Tapping overlapping views and triggering both onTapGesture of them.(Tapping through) in SWIFTUI

I have two overlapping views inside a ZStack. When I tap the top view, it triggers its onTapGesture first and then triggers the onTapGesture of the view underneath. Does any one know how to achieve this? Any help would be much appreciated!
jeep
  • 615
  • 2
  • 10
  • 19
0
votes
1 answer

SwiftUI View Inside A ForEach Has Wrong ID From OnTapGesture

I am doing a ForEach and creating views and adding an on tap gesture // objects = [MyObject] VStack { ForEach(objects, id: \.id) { obj in MyView(imageURL: obj.imageURL)// <===…
Aggressor
  • 13,323
  • 24
  • 103
  • 182
0
votes
0 answers

onTapGesture in Swift requiring two clicks instead of one

In my code below, I am creating a quiz app. When the user clicks the button with "next", the question and the answer options update. When the user clicks an answer row, it highlights in green. When they click next, this answer row is no longer…
0
votes
1 answer

If a ShapeView is initially outside but is brought into screen bounds, by scaleEffect, how is onTapGesture enabled for the whole ShapeView

I wish to draw ShapeViews which are initially, wholly or partly outside screen bounds and which have an .onTapGesture modifier. The ShapeViews may be brought into screen bounds by .scaleEffect. However, any part of the ShapeView which was initially…
0
votes
2 answers

SWIFTUI for IOS16 Navigation link stopped working when added ".onTapGesture", how to fix?

I'm using SWIFTUI for IOS16 development. I have a view with a navigation link that used to work great, but now that I have added an onTapGesture, stopped working. This is my code: import SwiftUI import AVKit struct SpecialVideo6: View { let…
Pro Girl
  • 762
  • 7
  • 21
0
votes
1 answer

Updating tapGesture area(frame) after device is rotated SwiftUI

I have an issue with updating the area(frame) of .onTapGesture after a device is rotated. Basically, even after changing @State var orientation the area where .onTapGesture works remain the same as on the previous orientation. Would appreciate…
imnikita
  • 21
  • 6
0
votes
1 answer

Slide Carousel cards on Cards tap in SwiftUI

I have created a carousel cards in SwiftUI, it is working on the DragGesture I want to achieve same experience on the tap of cards i.e. on .onTapGesture, which ever cards is being tapped it should be slide to centre on the screen like shown in the…
Anupam Mishra
  • 3,408
  • 5
  • 35
  • 63
0
votes
1 answer

SwiftUI trying to expand my sheet when tapping anywhere on it (similar to Maps app)

I’m trying to make my sheet expand when tapping anywhere on it but this implementation seems to completely override normal tap gesture and the navigation links inside the sheet only respond to a long tap now. How to expand the sheet without blocking…
xdlol123
  • 49
  • 3
0
votes
1 answer

Tap anywhere to add multiple items on canvas

import SwiftUI struct Level1: View { @State var tapScore = 0 @State var showingMinedHammer = false @State var points:[CGPoint] = [CGPoint(x:0,y:0), CGPoint(x:50,y:50)] @State private var location = CGPoint.zero // < here !! …