I've got a List view and each row of the list contains an HStack with some text view('s) and an image, like so:
HStack{
Text(group.name)
Spacer()
if (groupModel.required) { Text("Required").color(Color.gray) }
Image("ic_collapse").renderingMode(.template).rotationEffect(Angle(degrees: 90)).foregroundColor(Color.gray)
}.tapAction { self.groupSelected(self.group) }
This seems to work great, except when I tap in the empty section between my text and the image (where the Spacer()
is) the tap action is not registered. The tap action will only occur when I tap on the text or on the image.
Has anyone else faced this issue / knows a workaround?
spacer
? It's by definition, space. Maybe your UI is expecting something you might inUIKit
? If so, please, details it. - dfdObject One >
, is what the row would look like - and I would want the user to be able to tap anywhere on the row (That did not format with the spaces I thought it would - just imagine a space between the text and the>
) - QuinndidSelectRowAt
method on their UIKit table views - QuinnSpacer
. Maybe turn the entire thing into aButton
? In SwiftUI a Spacer is just that - spacing. - dfd