Instance Method


Begins a group of updates for the table view.


func beginUpdates()


For NSView-based table views, multiple row changes—that is, insertions, deletions, and moves—are animated simultaneously by surrounding calls to those method calls with beginUpdates() and endUpdates(). These methods are nestable.

The selected rows are maintained during the series of insertions, deletions, moves, and scrolling. If a selected row is deleted, a selection changed notification occurs after removeRows(at:withAnimation:) is called.

It is not necessary to call beginUpdates() and endUpdates() if only one insertion, deletion, or move is occurring and the table view is an NSView-based table view. When using an NSCell-based table view, you must surround any insertion, deletion, or move in an update block for animations to occur.

The main reason for doing a batch update of changes to a table view is to avoid having the table animate unnecessarily.

Note that these methods should be called to reflect changes in your model; they do not make any underlying model changes.

See Also

Updating the Table View Arrangement

func endUpdates()

Ends the group of updates for the table view.

func moveRow(at: Int, to: Int)

Moves the specified row to the new row location using animation.

func row(for: NSView) -> Int

Returns the index of the row for the specified view.

func column(for: NSView) -> Int

Returns the column index for the specified view.