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()
Why not just use a Button?
Button(action: { self.groupSelected(self.group) }) {
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)
}
}.foregroundColor(.primary)
If you don't want the button to apply the accent color to the Text(group.name), you have to set the foregroundColor as I did in my example.