MIDITimeTableViewDelegate

public protocol MIDITimeTableViewDelegate : AnyObject

Delegate functions to inform about changed cells and sizing of the time table.

  • midiTimeTableView(_:didChange:) Default implementation

    Informs about a user-driven table change: moves, resizes, overlap trims, split insertions, and deletions all flow through this single result.

    The delegate should apply result to its backing data source synchronously during this callback. MIDITimeTableView updates its internal layout immediately after this returns, so any newly inserted split cells can be dequeued and configured from the updated data source.

    Default Implementation

    Default no-op implementation, so existing conformers of MIDITimeTableViewDelegate don’t need to adopt it unless they want to receive resolved table changes.

    Declaration

    Swift

    func midiTimeTableView(_ midiTimeTableView: MIDITimeTableView, didChange result: MIDITimeTableCellEditResult)

    Parameters

    midiTimeTableView

    Time table that performed changes on.

    result

    Resolved change result with updated, removed and newly split cells.

  • Measure view height in the time table.

    Declaration

    Swift

    func midiTimeTableViewHeightForMeasureView(_ midiTimeTableView: MIDITimeTableView) -> CGFloat

    Parameters

    midiTimeTableView

    Time table to set its measure view’s height.

    Return Value

    Height of measure view.

  • Height of each row in the time table.

    Declaration

    Swift

    func midiTimeTableViewHeightForRows(_ midiTimeTableView: MIDITimeTableView) -> CGFloat

    Parameters

    midiTimeTableView

    Time table to set its rows height.

    Return Value

    Height of each row.

  • Width of header cells in each row.

    Declaration

    Swift

    func midiTimeTableViewWidthForRowHeaderCells(_ midiTimeTableView: MIDITimeTableView) -> CGFloat

    Parameters

    midiTimeTableView

    Time table to set its header cells widths in each row.

    Return Value

    Width of header cell in each row.

  • midiTimeTableViewSnapResolution(_:) Default implementation

    Number of grid subdivisions per beat, used for snapping cell moves/resizes and playhead/range head drags, and for drawing the finest (“subbeat”) grid lines. For example, 4 snaps to sixteenth notes within a quarter-note beat.

    Has a default implementation returning 4, so existing conformers don’t need to adopt it. If you want snapping to follow your time signature’s note value, return timeSignature(of:).noteValue.rawValue (or any other subdivision count you prefer — the two are independent: note value describes the meter, this describes the editing grid).

    Default Implementation

    Default implementation returning 4 (sixteenth notes in a quarter-note beat), matching the time table’s long-standing built-in behavior. Override to customise snapping.

    Declaration

    Swift

    func midiTimeTableViewSnapResolution(_ midiTimeTableView: MIDITimeTableView) -> Int

    Parameters

    midiTimeTableView

    Time table to set its snap resolution.

    Return Value

    Number of subdivisions per beat. Values below 1 are treated as 1.

  • Informs about user updated playhead position.

    Declaration

    Swift

    func midiTimeTableView(_ midiTimeTableView: MIDITimeTableView, didUpdatePlayhead position: Double)

    Parameters

    midiTimeTableView

    Time table that updated.

  • Informs about user updated range head position.

    Declaration

    Swift

    func midiTimeTableView(_ midiTimeTableView: MIDITimeTableView, didUpdateRangeHead position: Double)

    Parameters

    midiTimeTableView

    Time table that updated.

  • Called after the time table reports a change, giving apps one optional hook for committing their own undo/redo snapshot.

    Default Implementation

    Default no-op implementation.

    Declaration

    Swift

    func midiTimeTableViewShouldPushHistory(_ midiTimeTableView: MIDITimeTableView)