First needs to be long pressed, an than it activates the second gesture.
structContentView:View {// how far the circle has been dragged@Stateprivatevar offset = CGSize.zero// whether it is currently being dragged or not@Stateprivatevar isDragging =falsevar body: some View {// a drag gesture that updates offset and isDragging as it moves aroundlet dragGesture =DragGesture() .onChanged { value in offset = value.translation } .onEnded { _inwithAnimation { offset = .zero isDragging =false } }// a long press gesture that enables isDragginglet pressGesture =LongPressGesture() .onEnded { value inwithAnimation { isDragging =true } }// a combined gesture that forces the user to long press then draglet combined = pressGesture.sequenced(before: dragGesture) // a 64x64 circle that scales up when it's dragged, sets its offset to whatever we had back from the drag gesture, and uses our combined gesture
Circle() .fill(.red) .frame(width:64, height:64) .scaleEffect(isDragging ?1.5:1) .offset(offset) .gesture(combined) }}