Skip to content

Commit 513458a

Browse files
authored
Fix Mac Catalyst button support (respect interface idiom) (#228)
* Fix Mac Catalyst button support (respect interface idiom) * Simplify code * Remove debug prints
1 parent 7d775a2 commit 513458a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Sources/UIKitBackend/UIKitBackend+Control.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@ final class ButtonWidget: WrapperWidget<UIButton> {
1818
}
1919

2020
init() {
21-
let type: UIButton.ButtonType
2221
#if os(tvOS)
23-
type = .system
2422
event = .primaryActionTriggered
2523
#else
26-
type = .custom
2724
event = .touchUpInside
2825
#endif
29-
super.init(child: UIButton(type: type))
26+
super.init(child: UIButton(type: .system))
3027
}
3128
}
3229

@@ -268,7 +265,8 @@ extension UIKitBackend {
268265
UIKitBackend.attributedString(
269266
text: label,
270267
environment: environment,
271-
defaultForegroundColor: .link
268+
// Handle Mac Catalyst
269+
defaultForegroundColor: deviceClass == .desktop ? .label : .link
272270
),
273271
for: .normal
274272
)

0 commit comments

Comments
 (0)