From f5e115d36eb9dce6fdb3442482962c5d03b9737f Mon Sep 17 00:00:00 2001 From: Maximilian Maksutovic Date: Thu, 31 Aug 2023 18:04:31 -0700 Subject: [PATCH] =?UTF-8?q?Added=20@available=20derectives=20for=20MIDIMon?= =?UTF-8?q?itorKeyboard=20and=20removed=20Previ=E2=80=A6=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added @available derectives for MIDIMonitorKeyboard and removed Preview Macro * added space to comment --- Sources/Keyboard/MIDIMonitorKeyboard.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Keyboard/MIDIMonitorKeyboard.swift b/Sources/Keyboard/MIDIMonitorKeyboard.swift index 7c1817f..ec9aaa1 100644 --- a/Sources/Keyboard/MIDIMonitorKeyboard.swift +++ b/Sources/Keyboard/MIDIMonitorKeyboard.swift @@ -2,12 +2,14 @@ import SwiftUI import Tonic +@available(iOS 15, macOS 12, *) extension GraphicsContext { func fill(rect: CGRect, with color: Color) { fill(Path(roundedRect: rect, cornerRadius: 0), with: GraphicsContext.Shading.color(color)) } } +@available(iOS 15, macOS 12, *) struct MIDIMonitorKeyboard: View { var layout: KeyboardLayout @@ -87,9 +89,13 @@ struct MIDIMonitorKeyboard: View { } var p = PitchSet(pitches: [Pitch(65), Pitch(68), Pitch(71), Pitch(74)]) + +// Removing Preview macro until Xcode 15 is released +/* #Preview { MIDIMonitorKeyboard(layout: .piano(pitchRange: Pitch(61)...Pitch(88)), activatedPitches: p, colorFunction: { x in Color(cgColor: PitchColor.helmholtz[Int(x.pitchClass)])} ).frame(width: 600, height: 100) } +*/