Skip to content

Commit 5bd33e1

Browse files
committed
Fix Mac Catalyst button support (respect interface idiom)
1 parent 7d775a2 commit 5bd33e1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Sources/UIKitBackend/UIKitBackend+Control.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class ButtonWidget: WrapperWidget<UIButton> {
2323
type = .system
2424
event = .primaryActionTriggered
2525
#else
26-
type = .custom
26+
type = .system
2727
event = .touchUpInside
2828
#endif
2929
super.init(child: UIButton(type: type))
@@ -268,7 +268,8 @@ extension UIKitBackend {
268268
UIKitBackend.attributedString(
269269
text: label,
270270
environment: environment,
271-
defaultForegroundColor: .link
271+
// Handle Mac Catalyst
272+
defaultForegroundColor: deviceClass == .desktop ? .label : .link
272273
),
273274
for: .normal
274275
)

Sources/UIKitBackend/UIKitBackend.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public final class UIKitBackend: AppBackend {
4848

4949
public init() {
5050
self.appDelegateClass = ApplicationDelegate.self
51+
print(UIDevice.current.userInterfaceIdiom == .pad)
52+
if #available(macCatalyst 14.0, *) {
53+
print(UIDevice.current.userInterfaceIdiom == .mac)
54+
}
5155
}
5256

5357
public init(appDelegateClass: ApplicationDelegate.Type) {

0 commit comments

Comments
 (0)