How to handle long press on a Text() in iOS26

In iOS 18 the following code works to set a state variable when you hold your finger on the Text() field (well, the ScrollView()), but it doesn't work in iOS 26:

@State private var pressed: Bool = false
...

ScrollView {
  VStack {
    Text("Some text goes here")
  }.frame(maxWidth: .infinity)
}
.onTapGesture {}  // This is required to allow the long press gesture to be recognised
.gesture(
	DragGesture(minimumDistance: 0)
		.onChanged({ _ in
			pressed = true
		})
		.onEnded({ _ in
			pressed = false
		})
)
.background(pressed ? .black.opacity(0.4) : .clear)

I've tried changing this to:

var dragGesture: some Gesture {
  DragGesture(minimumDistance: 0)
    .onChanged({ _ in self.pressed = true })
    .onEnded({ _ in self.pressed = false })
}
...
ScrollView {
  VStack {
    Text("Some text goes here")
  }.frame(maxWidth: .infinity)
}
.gesture(dragGesture)
.background(pressed ? .black.opacity(0.4) : .clear)

And this:

var longPress: some Gesture {
  LongPressGesture(minimumDuration: 0.25)
    .onChanged({ _ in self.pressed = true })
    .onEnded({ _ in self.pressed = false })
}
...
ScrollView {
  VStack {
    Text("Some text goes here")
  }.frame(maxWidth: .infinity)
}
.gesture(longPress)
.background(pressed ? .black.opacity(0.4) : .clear)

Neither works.

Any ideas? Thanks.

Oh yeah, forgot to say that the way it's written above is required as I want the user to be able to long press the scrollview to apply the darker background, then be able to drag the content within the scrollview in the same action, i.e.:

  • Long press scrollview, background changes.
  • Drag finger, content scrolls.

If I use a longPressGesture() it only changes the background colour, and doesn't then allow the user to scroll.

How to handle long press on a Text() in iOS26
 
 
Q