commit db6c38cd1b8a5b2eceb3c91f4d1c9e4324b6f218
parent 030fee3c87b58c957318412ffb824179a33b4485
Author: Michael Camilleri <[email protected]>
Date: Sun, 8 Mar 2026 14:10:48 +0900
Rename PullCreationGestureModifier
The pull gesture recogniser is used for both pull-to-create and
pull-to-clear gestures. This commit renames the modifier so that this is
more apparent.
This commit also fixes a bug where dragging up to reorder a task would
trigger the pull-to-clear recogniser.
Co-Authored-By: Claude 4.6 Opus <[email protected]>
Diffstat:
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/ListlessiOS/Extensions/TaskListView+PullGestures.swift b/ListlessiOS/Extensions/TaskListView+PullGestures.swift
@@ -58,9 +58,10 @@ extension TaskListView {
}
}
-private struct PullCreationGestureModifier: ViewModifier {
+private struct PullGesturesModifier: ViewModifier {
@Binding var pullToCreate: TaskListView.PullToCreateState
@Binding var pullUpOffset: CGFloat
+ @Binding var isDragging: Bool
@State private var isAtBottom = false
@State private var clearPullStartedAtBottom = false
@@ -145,7 +146,7 @@ private struct PullCreationGestureModifier: ViewModifier {
private var clearCompletedPullGesture: some Gesture {
DragGesture(minimumDistance: 0, coordinateSpace: .local)
.onChanged { value in
- guard hasCompletedTasks else { return }
+ guard hasCompletedTasks, !isDragging else { return }
if !clearPullStartedAtBottom {
clearPullStartedAtBottom = isAtBottom
@@ -170,9 +171,10 @@ private struct PullCreationGestureModifier: ViewModifier {
}
extension View {
- func pullCreationGesture(
+ func pullGestures(
pullToCreate: Binding<TaskListView.PullToCreateState>,
pullUpOffset: Binding<CGFloat>,
+ isDragging: Binding<Bool>,
activeTaskIDs: [UUID],
hasCompletedTasks: Bool,
pullCreateThreshold: CGFloat,
@@ -181,9 +183,10 @@ extension View {
onClearCompleted: @escaping () -> Void
) -> some View {
modifier(
- PullCreationGestureModifier(
+ PullGesturesModifier(
pullToCreate: pullToCreate,
pullUpOffset: pullUpOffset,
+ isDragging: isDragging,
activeTaskIDs: activeTaskIDs,
hasCompletedTasks: hasCompletedTasks,
pullCreateThreshold: pullCreateThreshold,
diff --git a/ListlessiOS/Views/TaskListView.swift b/ListlessiOS/Views/TaskListView.swift
@@ -392,9 +392,10 @@ struct TaskListView: View, TaskListViewProtocol {
.overlay(alignment: .bottom) {
pullToClearIndicatorRow
}
- .pullCreationGesture(
+ .pullGestures(
pullToCreate: pullToCreateStateBinding,
pullUpOffset: pullUpOffsetStateBinding,
+ isDragging: isDraggingStateBinding,
activeTaskIDs: activeTasks.map(\.id),
hasCompletedTasks: !completedTasks.isEmpty,
pullCreateThreshold: pullCreateThreshold,