Questions tagged [swiftui-ontapgesture]

49 questions
0
votes
1 answer

Zoom Image over top of other Views SwiftUI

I have a image as thumbnail when image is tapped it should be expanded/zoom at the centre of screen with background as blur. I tried scale effect but the image is not on top of other view but looks like behind (see pics). How to achieve this zoomed…
tintin
  • 335
  • 2
  • 8
0
votes
2 answers

SwiftUI List only taps content

I have a List in SwiftUI that I populate with a custom SwiftUI cell, the issue is that on tap I need to do some stuff and the tap only works when you click the text in the cell, if you click any empty space it will not work. How can I fix…
tHatpart
  • 1,302
  • 3
  • 12
  • 27
0
votes
0 answers

swiftui TextView with action text

Hi everyone I am creating a text editor and I would like to know if there is the possibility to insert a Uibutton in the middle of the text. I am not referring to a url but to a real button. For now I am creating the editor with a…
Stefano Vet
  • 567
  • 1
  • 7
  • 18
0
votes
1 answer

How can I get CGRect of tapped rectangle in ScrollView?

Hello, I want to know the CGRect(coordinates and width/height) of dynamic size rectangle which user tapped in ScrollView. Is there any way to get this?
0
votes
2 answers

SwiftUI Horizontal ScrollView onTapGesture is Off

I am experiencing some very odd behavior from a Horizontal ScrollView, it seems as if the clickable frame of the cells are offset. For example, if you click on left half of the first cell it will register the click for the first cell, but if you…
tHatpart
  • 1,302
  • 3
  • 12
  • 27
0
votes
1 answer

SwiftUI Mac: Adding buttonStyle Makes Button Click Propagate to Parent

I am trying to create a situation in a SwiftUI Mac app where when I click a Button inside a parent view, only the Button's action is trigger—not any of the tap gestures attached to its parent. Here is a simple example that reproduces the…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
0
votes
1 answer

Restructure NavigationLink to Button for LongPressGesture

I am trying to put an option for .onlongpressgesture for this list of groups. However, it doesn't seem to work and I figure, it will work on Button. I have tried to apply ".onTapGesture" and ".onLongPressGesture", but there is no effect. Is there a…
0
votes
1 answer

SwifUI onTapGesture inside ScollView not alway detect tap

I have problem with Views that have onTapGesture and are placed inside ScollView This onTapGesture is not always reacting to tap gesture. I need to tap precisely on such view. It seems like there is conflict with ScrollView drag? I've…
0
votes
0 answers

swiftUI - how to pass core data values of an item from ForEach list in NavigationLink to Detail view

I just cannot figure out how to pass core data values of an item from ForEach list in NavigationLink to Detail view. Here is the code that got error: "Cannot convert value of type 'FetchedResults.Element' (aka 'FileEnt') to expected argument type…
0
votes
0 answers

SwiftUI .onTapGesture does not work until list is scrolled

I have a Textfield used to name doorways. You tap the textfield and a list is unfolded below with a list of common room names. I can't select an item from the list until after I scroll the list. Here is my code: internal var body: some View { …
0
votes
2 answers

SwiftUI: On tap gesture switches views

I have the following simplified code in a project using XCode 13.2. The intended functionality is to have 2 tabs (Tab1 and Tab2), and the user is able to tap the screen on Tab2 to toggle the background from red to green. Instead, however, when Tab2…
Stoic
  • 945
  • 12
  • 22
0
votes
2 answers

SwiftUI Image is not changing

I'm writing my project with SwiftUI using VIPER architecture and I faced with the problem that my image is not updating after calling .onTapGesture. Here is the code blocks that relates to this functionality: Model: class FavoriteBeers{ var…
0
votes
1 answer

Show and Hide Everything in a VStack

I have a custom SwiftUI View where in an HStack I have two VStacks on opposite ends. I need each to have its own double-tap gesture to show and hide the items in the VStack. Here is what I have tried: @State var displayRewind = false VStack { …
Luke Irvin
  • 1,179
  • 1
  • 20
  • 39
0
votes
1 answer

How to select an item by a button or tapGesture in my SwiftUI List and transfer it to another view

In my app I´m needing two players (only 2 names/strings), selected from an array built in a List/ForEach SwiftUI-code, which are used in another view. What is the way to bring the name into a string for my Text(item)? Can I select two items out of…
0
votes
0 answers

SwiftUI Frame width issue

I'm creating a scrollable selection bar. I would like a selection indicator under the text to match the width of the text rect above it. So in the image below, the red would fit the full width of the black area. import SwiftUI struct…
Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70