Skip to content

Drag & Drop-Reordering

Compare
Choose a tag to compare
@DivineDominion DivineDominion released this 08 Apr 11:17
· 46 commits to master since this release

Apart from using (and fixing) Auto Layout for the component, it's now possible to drag items around to reorder them.

Library

  • added drag-to-reorder

  • added double-click callbacks

  • added new delegate methods:

    public protocol FatSidebarDelegate: class {
        /// Triggered after the user finishes dragging an item into a new place. 
        func sidebar(_ sidebar: FatSidebar, didMoveItemFrom oldIndex: Int, to newIndex: Int)
    
        /// Triggered when an item is single-clicked and its status changes. 
        /// Already selected items that cannot be deselected will not trigger this.
        func sidebar(_ sidebar: FatSidebar, didChangeSelection selectionIndex: Int)
    
        /// Triggered by double-clicking an item.
        func sidebar(_ sidebar: FatSidebar, editItem index: Int)
    }
  • added notifications to FatSidebarView for most events:

    • didToggleItemNotification
    • didSelectItemNotification
    • didDeselectItemNotification
    • didReorderItemNotification
    • didDoubleClickItemNotification

Sample app

  • added real model to power the sidebar (like you would in your app)
  • made items editable with double-click