Skip to content

Commit d63a14c

Browse files
author
systemblueteam
committed
fix: replace deprecated foregroundColor, cornerRadius, and font APIs
1 parent 3b1a7bf commit d63a14c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Demo/Shared/ContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ struct ContentView: View {
150150
Keyboard(latching: true, noteOn: noteOn, noteOff: noteOff) { pitch, isActivated in
151151
if isActivated {
152152
ZStack {
153-
Rectangle().foregroundColor(.black)
153+
Rectangle().foregroundStyle(.black)
154154
VStack {
155155
Spacer()
156156
Text(pitch.note(in: .C).description).font(.largeTitle)
157157
}.padding()
158158
}
159159

160160
} else {
161-
Rectangle().foregroundColor(randomColors[Int(pitch.intValue) % 12])
161+
Rectangle().foregroundStyle(randomColors[Int(pitch.intValue) % 12])
162162
}
163163
}
164164
.frame(minWidth: 100, minHeight: 100)

Sources/Keyboard/KeyboardKey.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ public struct KeyboardKey: View {
109109
GeometryReader { proxy in
110110
ZStack(alignment: alignment) {
111111
Rectangle()
112-
.foregroundColor(keyColor)
112+
.foregroundStyle(keyColor)
113113
.padding(.top, topPadding(proxy.size))
114114
.padding(.leading, leadingPadding(proxy.size))
115-
.cornerRadius(relativeCornerRadius(in: proxy.size))
115+
.clipShape(RoundedRectangle(cornerRadius: relativeCornerRadius(in: proxy.size)))
116116
.padding(.top, negativeTopPadding(proxy.size))
117117
.padding(.leading, negativeLeadingPadding(proxy.size))
118118
.padding(.trailing, 0.5)
119119
Text(text)
120-
.font(Font(.init(.system, size: relativeFontSize(in: proxy.size))))
121-
.foregroundColor(textColor)
120+
.font(.system(size: relativeFontSize(in: proxy.size)))
121+
.foregroundStyle(textColor)
122122
.padding(relativeFontSize(in: proxy.size) / 3.0)
123123
}
124124
}

0 commit comments

Comments
 (0)