MutableListModel

public protocol MutableListModel : ListModel

Mutable file list model.

Note that this API is not thread-safe. Call all methods and properties only from the UI thread.

  • True if the hidden files are shown.

    Declaration

    Swift

    var showHiddenFiles: Bool { get set }
  • The text filter for the Quick Select.

    Declaration

    Swift

    var quickSelect: String { get set }
  • Local file filter.

    Declaration

    Swift

    var filter: (VirtualFile) -> Bool { get set }
  • Global file filter.

    Declaration

    Swift

    var globalFilter: (VirtualFile) -> Bool { get set }
  • Ordering strategy.

    Declaration

    Swift

    var ordering: ListOrdering { get set }
  • Refreshes the model.

    Declaration

    Swift

    func refresh(force: Bool, itemChooser: @escaping ItemChooser)

    Parameters

    force

    refresh the model even if a file watcher is attached.

  • Loads the specified directory.

    Declaration

    Swift

    func load(directory: VirtualFile, itemChooser: @escaping ItemChooser)
  • Index of the current item, or a negative number if the list does not have a current item.

    Declaration

    Swift

    var currentIndex: Int { get set }
  • Select items in range.

    Declaration

    Swift

    func select(range: CountableRange<Int>)
  • Deselect items in range.

    Declaration

    Swift

    func deselect(range: CountableRange<Int>)
  • Inverts selection in range.

    Declaration

    Swift

    func invertSelection(range: CountableRange<Int>)
  • Selected item indices.

    This property is quite expensive as it creates the new array, iterating over all list elements. Use isSelected(index) when possible.

    Declaration

    Swift

    var selectedIndices: [Int] { get set }
  • Returns the next selectable item with the given direction, or -1 if the item was not found.

    Declaration

    Swift

    func getNextIndex(index: Int, nextItemFactory: (Int) -> Int) -> Int
  • Executes the block after the successful directory loading. Executes immediately if there is no active loading process.

    Declaration

    Swift

    func afterRefresh(block: @escaping (MutableListModel) -> ())
  • refresh(force:) Extension method

    Refreshes the model.

    Declaration

    Swift

    public func refresh(force: Bool)

    Parameters

    force

    refresh the model even if a file watcher is attached.

  • load(directory:) Extension method

    Loads the specified directory.

    Declaration

    Swift

    public func load(directory: VirtualFile)
  • selectAll() Extension method

    Selects all items.

    Declaration

    Swift

    public func selectAll()
  • deselectAll() Extension method

    Deselects all items.

    Declaration

    Swift

    public func deselectAll()
  • moveCursorToTop() Extension method

    Makes the first item current.

    Declaration

    Swift

    public func moveCursorToTop()
  • moveCursorToBottom() Extension method

    Makes the last item current.

    Declaration

    Swift

    public func moveCursorToBottom()
  • select(index:) Extension method

    Selects the item with the specified index.

    Declaration

    Swift

    public func select(index: Int)
  • deselect(index:) Extension method

    Deselects the item with the specified index.

    Declaration

    Swift

    public func deselect(index: Int)
  • invertSelection() Extension method

    Inverts the selection.

    Declaration

    Swift

    public func invertSelection()
  • selectCurrent() Extension method

    Selects the current item.

    Declaration

    Swift

    public func selectCurrent()
  • invertSelectionCurrent() Extension method

    Inverts the selection for the current index.

    Declaration

    Swift

    public func invertSelectionCurrent()
  • invertSelection(index:) Extension method

    Toggles selection for the item on the given index.

    Declaration

    Swift

    public func invertSelection(index: Int)
  • Loads the specified directory.

    Declaration

    Swift

    public func load(directory: VirtualFile, nameToSelect name: String)

    Parameters

    nameToSelect

    a simple name of a file to select after the refresh.

  • refresh(force:nameToSelect:) Extension method

    Refreshes the model.

    Declaration

    Swift

    public func refresh(force: Bool, nameToSelect name: String)

    Parameters

    force

    refresh the model even if a file watcher is attached.

    nameToSelect

    a simple name of a file to select after the refresh.

  • Loads the specified directory.

    Declaration

    Swift

    public func load(directory: VirtualFile, pathToSelect name: String)

    Parameters

    pathToSelect

    an absolute path of an item to select after the refresh.

  • refresh(force:pathToSelect:) Extension method

    Refreshes the model.

    Declaration

    Swift

    public func refresh(force: Bool, pathToSelect name: String)

    Parameters

    force

    refresh the model even if a file watcher is attached.

    pathToSelect

    an absolute path of an item to select after the refresh.