Skip to content

Commit 5174849

Browse files
committed
Fix AppKitBackend post-rebase and revert CounterApp
1 parent 94c713d commit 5174849

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Examples/Sources/CounterExample/CounterApp.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ struct CounterApp: App {
1313
var body: some Scene {
1414
WindowGroup("CounterExample: \(count)") {
1515
#hotReloadable {
16-
VStack(alignment: .leading, spacing: 1) {
17-
ForEach(Font.TextStyle.allCases) { style in
18-
Text("This is \(style)")
19-
.font(.system(style))
16+
HStack(spacing: 20) {
17+
Button("-") {
18+
count -= 1
19+
}
20+
Text("Count: \(count)")
21+
Button("+") {
22+
count += 1
2023
}
2124
}
22-
// VStack(alignment: .leading, spacing: 1) {
23-
// ForEach(Font.Weight.allCases) { weight in
24-
// Text("This is \(weight) text")
25-
// .fontWeight(weight)
26-
// }
27-
// }
25+
.padding()
2826
}
2927
}
3028
.defaultSize(width: 400, height: 200)

Sources/AppKitBackend/AppKitBackend.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,9 @@ public final class AppKitBackend: AppBackend {
749749
textField.isEnabled = environment.isEnabled
750750
textField.placeholderString = placeholder
751751
textField.appearance = environment.colorScheme.nsAppearance
752-
if textField.font != Self.font(for: environment) {
753-
textField.font = Self.font(for: environment)
752+
let resolvedFont = environment.resolvedFont
753+
if textField.font != Self.font(for: resolvedFont) {
754+
textField.font = Self.font(for: resolvedFont)
754755
}
755756
textField.onEdit = { textField in
756757
onChange(textField.stringValue)
@@ -803,8 +804,9 @@ public final class AppKitBackend: AppBackend {
803804
textEditor.onEdit = { textView in
804805
onChange(self.getContent(ofTextEditor: textView))
805806
}
806-
if textEditor.font != Self.font(for: environment) {
807-
textEditor.font = Self.font(for: environment)
807+
let resolvedFont = environment.resolvedFont
808+
if textEditor.font != Self.font(for: resolvedFont) {
809+
textEditor.font = Self.font(for: resolvedFont)
808810
}
809811
textEditor.appearance = environment.colorScheme.nsAppearance
810812
textEditor.isEditable = environment.isEnabled

0 commit comments

Comments
 (0)