Key

public final class Key : UIView

Visual representation of a piano key. Each key has an associated Note value which determines what MIDI note the key will emit when touched.

  • If true, audio is muted

    Declaration

    Swift

    static var isMuted: Bool
  • How to label the key

    Declaration

    Swift

    static var keyLabelOption: KeyLabelOption
  • Current user-adjustable key width from settings

    Declaration

    Swift

    static var keyWidth: CGFloat
  • The note to play when touched

    Declaration

    Swift

    public let note: Note
  • State of the key – true when touched/pressed

    Declaration

    Swift

    public var pressed: Bool { get set }
  • Create new Key instance

    Declaration

    Swift

    public init(frame: CGRect, note: Note)

    Parameters

    frame

    location of the key

    note

    the note that the key plays

  • Regenerate a Key using contents of an NSCoder

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)

    Parameters

    coder

    data container to use

  • Draw the key. Relies on the KeyboardRender methods to do the work.

    Declaration

    Swift

    public override func draw(_ rect: CGRect)

    Parameters

    rect

    the region to draw in

  • Description of Key instance for logging

    Declaration

    Swift

    public override var description: String { get }