Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
// Status: WIP

#if os(iOS) || os(visionOS)
// FIXME
package class UIKitEventBindingBridge {

@_spi(ForOpenSwiftUIOnly)
import OpenSwiftUICore
package import UIKit

// FIXME
package class UIKitEventBindingBridge: EventBindingBridge {
package var gestureRecognizer: UIGestureRecognizer?
// var hoverGestureRecognizer: UIKitHoverGestureRecognizer
// var keyPressResponder: UIKitKeyPressResponder?
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,14 @@ public func _makeUIHostingView<Content>(_ view: Content) -> NSObject where Conte
_UIHostingView(rootView: view)
}

// MARK: - _UIHostingView + AnyUIHostingView

extension _UIHostingView: AnyUIHostingView {
package var debugName: String? {
// TODO: UIHostingViewDebugOptions
_openSwiftUIUnimplementedWarning()

@augmentcode augmentcode Bot Jun 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sources/OpenSwiftUI/Integration/Hosting/UIKit/View/UIHostingView+Extension.swift:415 — Calling _openSwiftUIUnimplementedWarning() inside debugName can spam logs and can even fatalError under OPENSWIFTUI_DEVELOPMENT when UIHostingViewDebugLayer.name is queried repeatedly by CoreAnimation. Consider returning nil without warning until UIHostingViewDebugOptions is implemented.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

return nil
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con

final package let renderer = DisplayList.ViewRenderer(platform: .init(definition: UIViewPlatformViewDefinition.self))

// final package let eventBindingManager: EventBindingManager

var allowUIKitAnimations: Int32 = .zero

var disabledBackgroundColor: Bool = false
Expand Down Expand Up @@ -115,7 +113,7 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con

var currentEvent: UIEvent? = nil

// var eventBridge: UIKitEventBindingBridge
package var eventBridge: UIKitEventBindingBridge

var colorScheme: ColorScheme? = nil {
didSet {
Expand Down Expand Up @@ -177,6 +175,7 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
>.self,
options: options
)
eventBridge = UIKitEventBindingBridge(eventBindingManager: _base.eventBindingManager)
// TODO
if _UIUpdateAdaptiveRateNeeded() {
_base.viewGraph.append(feature: EnableVFDFeature())
Expand Down Expand Up @@ -300,6 +299,10 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
#endif
viewGraph.emptyTransaction(transaction)
}
if traitCollection.userInterfaceIdiom != previousTraitCollection?.userInterfaceIdiom {
updateEventBridge()
}
invalidateProperties(.environment)
}

open override func safeAreaInsetsDidChange() {
Expand Down Expand Up @@ -344,7 +347,17 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
}

// TODO


func updateEventBridge() {
let bridge = eventBridge
guard traitCollection.userInterfaceIdiom == .carPlay,
let gestureRecognizer = bridge.gestureRecognizer
else {
return
}
gestureRecognizer.allowedTouchTypes = [NSNumber(value: UITouch.TouchType.direct.rawValue)]
}

func setRootView(_ view: Content, transaction: Transaction) {
_rootView = view
viewGraph.asyncTransaction(transaction) { [weak self] in
Expand Down
Loading