Class

NSArray​Controller

NSArray​Controller is a bindings compatible class that manages a collection of objects. Typically the collection is an array, however, if the controller manages a relationship of a managed object (see NSManaged​Object) the collection may be a set. NSArray​Controller provides selection management and sorting capabilities.

Symbols

Managing Sort Descriptors

var sort​Descriptors:​ [NSSort​Descriptor]

An array of NSSort​Descriptor objects, used by the receiver to arrange its content.

Arranging Objects

func arrange([Any])

Returns a given array, appropriately sorted and filtered.

var arranged​Objects:​ Any

An array containing the receiver’s content objects arranged using arrange(_:​).

func rearrange​Objects()

Triggers filtering of the receiver’s content.

Managing Content

func add(Any?)

Creates and adds a new object to the receiver’s content and arranged objects.

Selection Attributes

var avoids​Empty​Selection:​ Bool

A Boolean value that indicates whether the receiver requires that the content array attempt to maintain a selection

var preserves​Selection:​ Bool

A Boolean value that indicates whether the receiver will attempt to preserve the current selection when the content changes

var always​Uses​Multiple​Values​Marker:​ Bool

A Boolean value that indicates whether the receiver always returns the multiple values marker when multiple objects are selected

Managing selections

var selection​Index:​ Int

The index of the first object in the receiver’s selection

func set​Selection​Index(Int)

Sets the receiver’s selection to the given index, and returns a Boolean value that indicates whether the selection was changed.

var selects​Inserted​Objects:​ Bool

A Boolean value that indicates whether the receiver automatically selects inserted objects

func set​Selection​Indexes(Index​Set)

Sets the receiver’s selection indexes and returns a Boolean value that indicates whether the selection changed.

var selection​Indexes:​ Index​Set

An index set containing the indexes of the receiver’s currently selected objects in the content array

func add​Selection​Indexes(Index​Set)

Adds the objects at the specified indexes in the receiver’s content array to the current selection, returning true if the selection was changed.

func remove​Selection​Indexes(Index​Set)

Removes the object as the specified indexes from the receiver’s current selection, returning true if the selection was changed.

func set​Selected​Objects([Any])

Sets objects as the receiver’s current selection, returning true if the selection was changed.

var selected​Objects:​ [Any]!

An array containing the receiver’s selected objects

func add​Selected​Objects([Any])

Adds objects from the receiver’s content array to the current selection, returning true if the selection was changed.

func remove​Selected​Objects([Any])

Removes objects from the receiver’s current selection, returning true if the selection was changed.

func select​Next(Any?)

Selects the next object, relative to the current selection, in the receiver’s arranged content.

var can​Select​Next:​ Bool

A Boolean value indicating whether the next object, relative to the current selection, in the receiver’s content array can be selected

func select​Previous(Any?)

Selects the previous object, relative to the current selection, in the receiver’s arranged content.

var can​Select​Previous:​ Bool

A Boolean value indicating whether the previous object, relative to the current selection, in the receiver’s content array can be selected

Inserting

var can​Insert:​ Bool

Returns a Boolean value that indicates whether an object can be inserted into the receiver’s content collection.

func insert(Any?)

Creates a new object and inserts it into the receiver’s content array.

Adding and Removing Objects

func add​Object(Any)

Adds object to the receiver’s content collection and the arranged objects array.

func add(contents​Of:​ [Any])

Adds objects to the receiver’s content collection.

func insert(Any, at​Arranged​Object​Index:​ Int)

Inserts object into the receiver’s arranged objects array at the location specified by index, and adds it to the receiver’s content collection.

func insert(contents​Of:​ [Any], at​Arranged​Object​Indexes:​ Index​Set)

Inserts objects into the receiver’s arranged objects array at the locations specified in indexes, and adds it to the receiver’s content collection.

func remove(at​Arranged​Object​Index:​ Int)

Removes the object at the specified index in the receiver’s arranged objects from the receiver’s content array.

func remove(at​Arranged​Object​Indexes:​ Index​Set)

Removes the objects at the specified indexes in the receiver’s arranged objects from the content array.

func remove(Any?)

Removes the receiver’s selected objects from the content collection.

func remove​Object(Any)

Removes object from the receiver’s content collection.

func remove(contents​Of:​ [Any])

Removes objects from the receiver’s content collection.

Filtering Content

var clears​Filter​Predicate​On​Insertion:​ Bool

A Boolean value that indicates whether the receiver automatically clears an existing filter predicate when new items are inserted or added to the content

var filter​Predicate:​ NSPredicate?

A predicate used by the receiver to filter the array controller contents

Automatic Content Rearranging

var automatically​Rearranges​Objects:​ Bool

A Boolean that indicates if the receiver automatically rearranges its content to correspond to the current sort descriptors and filter predicates

var automatic​Rearrangement​Key​Paths:​ [String]?

An array of key paths that trigger automatic content sorting or filtering

func did​Change​Arrangement​Criteria()

Invoked when any criteria for arranging objects change.

Relationships