Skip to content

Commit c63f25a

Browse files
authored
Fix UIKit CI (#122)
1 parent 107758b commit c63f25a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Sources/UIKitBackend/UIKitBackend+Menu.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extension UIKitBackend {
1010
return Menu()
1111
}
1212

13+
@available(tvOS 14, *)
1314
static func buildMenu(
1415
content: ResolvedMenu,
1516
label: String,
@@ -34,7 +35,11 @@ extension UIKitBackend {
3435
public func updatePopoverMenu(
3536
_ menu: Menu, content: ResolvedMenu, environment _: EnvironmentValues
3637
) {
37-
menu.uiMenu = UIKitBackend.buildMenu(content: content, label: "")
38+
if #available(iOS 14, macCatalyst 14, tvOS 17, *) {
39+
menu.uiMenu = UIKitBackend.buildMenu(content: content, label: "")
40+
} else {
41+
preconditionFailure("Current OS is too old to support menu buttons.")
42+
}
3843
}
3944

4045
public func updateButton(

Sources/UIKitBackend/UIKitBackend.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ open class ApplicationDelegate: UIResponder, UIApplicationDelegate {
246246
/// point in your implementation. If you do not, then calls to
247247
/// ``SwiftCrossUI/Scene/commands(_:)`` will have no effect.
248248
open override func buildMenu(with builder: any UIMenuBuilder) {
249-
guard builder.system == .main else { return }
249+
guard #available(tvOS 14, *),
250+
builder.system == .main
251+
else { return }
250252

251253
for submenu in menu {
252254
let menuIdentifier = mapMenuIdentifier(submenu.label)

Sources/UIKitBackend/Widget.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class BaseControllerWidget: UIViewController, WidgetProtocolHelpers {
273273
at: parentWidget.childWidgets.firstIndex { $0 === self }!)
274274
self.parentWidget = nil
275275
}
276-
if let parent {
276+
if parent != nil {
277277
willMove(toParent: nil)
278278
removeFromParent()
279279
}

0 commit comments

Comments
 (0)