KeyParamsSequence

internal struct KeyParamsSequence : Sequence, IteratorProtocol

Custom sequence / iterator that will spit out 2-tuples of CGRect and Note values for the next key in a keyboard view.

  • Construct a new sequence generator for the given settings

    Declaration

    Swift

    init(keyWidth: CGFloat, keyHeight: CGFloat, firstMidiNote: Int, lastMidiNote: Int)

    Parameters

    width

    the key width to use

    keyHeight

    the key height to use

    firstMidiNote

    the MIDI note of the first key to generate

    lastMidiNote

    the MIDI note of the last key to generate

  • Create a new iterator for the sequence.

    Declaration

    Swift

    @inlinable
    func makeIterator() -> KeyParamsSequence

    Return Value

    self

  • Declaration

    Swift

    @inlinable
    var underestimatedCount: Int { get }
  • Obtain the next element from the sequence.

    Declaration

    Swift

    mutating func next() -> (CGRect, Note)?

    Return Value

    2-tuple containing the frame to use for the key and the note that the key will play