MIDITimeTableViewDelegate
public protocol MIDITimeTableViewDelegate : AnyObject
Delegate functions to inform about changed cells and sizing of the time table.
-
midiTimeTableView(_:Default implementationdidChange: ) 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
resultto its backing data source synchronously during this callback.MIDITimeTableViewupdates 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
MIDITimeTableViewDelegatedon’t need to adopt it unless they want to receive resolved table changes.Declaration
Swift
func midiTimeTableView(_ midiTimeTableView: MIDITimeTableView, didChange result: MIDITimeTableCellEditResult)Parameters
midiTimeTableViewTime table that performed changes on.
resultResolved change result with updated, removed and newly split cells.
-
Measure view height in the time table.
Declaration
Swift
func midiTimeTableViewHeightForMeasureView(_ midiTimeTableView: MIDITimeTableView) -> CGFloatParameters
midiTimeTableViewTime 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) -> CGFloatParameters
midiTimeTableViewTime 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) -> CGFloatParameters
midiTimeTableViewTime 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) -> IntParameters
midiTimeTableViewTime 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
midiTimeTableViewTime table that updated.
-
Informs about user updated range head position.
Declaration
Swift
func midiTimeTableView(_ midiTimeTableView: MIDITimeTableView, didUpdateRangeHead position: Double)Parameters
midiTimeTableViewTime table that updated.
-
midiTimeTableViewShouldPushHistory(_:Default implementation) 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)