Skip to content

Add manual drag-and-drop reordering for saved locations - #169

Open
daneden wants to merge 2 commits into
mainfrom
claude/location-list-drag-drop-2d7r7s
Open

Add manual drag-and-drop reordering for saved locations#169
daneden wants to merge 2 commits into
mainfrom
claude/location-list-drag-drop-2d7r7s

Conversation

@daneden

@daneden daneden commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Adds support for manual drag-and-drop reordering of saved locations. Users can now reorder locations by dragging them in the sidebar, with the order persisted to Core Data and synced across devices via CloudKit.

Key Changes

  • New sorting mode: Added .manual case to Preferences.SortingFunction enum, allowing users to sort by their custom drag-and-drop order
  • Data model migration: Created Solstice 2.xcdatamodel with new sortIndex attribute on SavedLocation to persist manual ordering
  • Drag-and-drop implementation:
    • Added .onMove() modifier to SidebarListView to enable row reordering
    • Implemented moveItems() method that persists reorder operations and automatically switches to manual sort mode
    • Added nextSortIndex() helper to assign sort indices to newly created locations
  • Sort signature tracking: Updated SortSignature to include sortIndices so reorders synced from other devices trigger re-sorting
  • UI updates:
    • Added "Manual" option to the sort picker in ContentView
    • Hidden the sort order picker when manual mode is active (since reversing a manual order would be unexpected)
  • Localization: Added "Manual" string with machine translations for 9 languages (Arabic, German, Spanish, French, Italian, Japanese, Dutch, Polish, Simplified Chinese)
  • Version bump: Updated marketing version from 3.2.0 to 3.3.0

Implementation Details

  • Manual sort falls back to title-based ordering for locations that haven't been dragged (both have sortIndex of 0) to maintain stable sorting
  • Dragging in any sort mode adopts the on-screen order as the new manual order and switches to it, preventing the row from snapping back
  • The sort signature now includes sort indices to ensure CloudKit syncs of reorders from other devices trigger proper re-sorting

https://claude.ai/code/session_01SuVkpBmDxf4SmS9XbMh4Jf

Adds a "Manual" sort option backed by a new `sortIndex` attribute on
`SavedLocation`, introduced in a second model version so existing stores
migrate lightweight. Dragging a row in any sort mode adopts the on-screen
order as the manual order and switches to it, so the row stays where it was
dropped. New locations append to the end of the manual order, and the order
picker is hidden while sorting manually since reversing a hand-made order
would only confuse the next drag.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuVkpBmDxf4SmS9XbMh4Jf
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SuVkpBmDxf4SmS9XbMh4Jf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants