File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,13 @@ class ContextManager: ObservableObject {
201201 }
202202 }
203203
204+ // MARK: - Context Reordering
205+ /// Reorder contexts and persist the new order
206+ func reorderContexts( fromOffsets: IndexSet , toOffset: Int ) {
207+ contexts. move ( fromOffsets: fromOffsets, toOffset: toOffset)
208+ saveContexts ( )
209+ }
210+
204211 // MARK: - Application Management
205212
206213 func closeContextApplications( _ context: Context ) {
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ struct ContextSidebarView: View {
4848 . tag ( context. id as UUID ? )
4949 . listRowBackground ( EmptyView ( ) )
5050 }
51+ . onMove { indices, newOffset in
52+ contextManager. reorderContexts ( fromOffsets: indices, toOffset: newOffset)
53+ }
5154 }
5255 . listStyle ( . sidebar)
5356 . frame ( maxWidth: . infinity, alignment: . leading)
You can’t perform that action at this time.
0 commit comments