Skip to content

Commit

Permalink
Added @available derectives for MIDIMonitorKeyboard and removed Previ… (
Browse files Browse the repository at this point in the history
#26)

* Added @available derectives for MIDIMonitorKeyboard and removed Preview Macro

* added space to comment
  • Loading branch information
maksutovic committed Sep 1, 2023
1 parent df6249b commit f5e115d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Keyboard/MIDIMonitorKeyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
*/

0 comments on commit f5e115d

Please sign in to comment.