ListModel

public protocol ListModel : AnyObject

File list model.

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

  • Current directory.

    Declaration

    Swift

    var directory: VirtualFile? { get }
  • True if the hidden files are shown.

    Declaration

    Swift

    var showHiddenFiles: Bool { get }
  • Quick Select text filter.

    Declaration

    Swift

    var quickSelect: String { get }
  • Quick select state.

    Declaration

    Swift

    var quickSelectState: ListModelQuickSelectState { get }
  • Local file filter.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    var ordering: ListOrdering { get }
  • Index of the current item, or a negative number if the list does not have a current item.

    Declaration

    Swift

    var currentIndex: Int { get }
  • Number of the selected items.

    Declaration

    Swift

    var selectedCount: Int { get }
  • True if the item with the given index is selected.

    Declaration

    Swift

    func isSelected(index: Int) -> Bool
  • 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 }
  • Number of the list items.

    Declaration

    Swift

    var count: Int { get }
  • Returns the list item at index.

    Declaration

    Swift

    subscript(index: Int) -> VirtualFile { get }
  • isAnythingSelected Extension method

    True if at least one item is selected.

    Declaration

    Swift

    public var isAnythingSelected: Bool { get }
  • hasCurrent Extension method

    True if the list has a current item.

    Declaration

    Swift

    public var hasCurrent: Bool { get }
  • lastIndex Extension method

    The last item index, of -1 if the model is empty.

    Declaration

    Swift

    public var lastIndex: Int { get }
  • currentFile Extension method

    The current item, or nil if the list does not have a current item.

    Declaration

    Swift

    public var currentFile: VirtualFile? { get }
  • selectedFiles Extension method

    Selected items.

    Declaration

    Swift

    public var selectedFiles: [VirtualFile] { get }
  • activeFiles Extension method

    Selected items if anything is selected, or the current item if the selection is empty. Returns the empty array if both selection is empty and the current item are not set.

    Note: only selectable items are returned (and `GoUpVirtualFile` is not a selectable item).
    

    Declaration

    Swift

    public var activeFiles: [VirtualFile] { get }
  • isEmpty Extension method

    True if the list contains zero elements, false otherwise.

    Declaration

    Swift

    public var isEmpty: Bool { get }
  • isNotEmpty Extension method

    True if the list contains at least one element.

    Declaration

    Swift

    public var isNotEmpty: Bool { get }
  • isMutableFileSystem Extension method

    True if the current file system is mutable.

    Declaration

    Swift

    public var isMutableFileSystem: Bool { get }
  • isLocalFileSystem Extension method

    True if the current file system is a local file system.

    Declaration

    Swift

    public var isLocalFileSystem: Bool { get }