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 @@ -238,6 +238,11 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
// TODO
super.init(frame: .zero)
// TODO

if _UIUpdateAdaptiveRateNeeded() {
viewGraph.append(feature: EnableVFDFeature())
}

initializeViewGraph()
// RepresentableContextValues.current =

Expand Down Expand Up @@ -320,7 +325,7 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
let interval = if let displayLink, displayLink.willRender {
0.0
} else {
renderInterval(timestamp: .systemUptime) / UIAnimationDragCoefficient()
renderInterval(timestamp: .systemUptime) / Double(UIAnimationDragCoefficient())
}
render(interval: interval, targetTimestamp: nil)
Update.unlock()
Expand Down Expand Up @@ -445,6 +450,13 @@ open class _UIHostingView<Content>: UIView, XcodeViewDebugDataProvider where Con
}

static func defaultViewGraphOutputs() -> ViewGraph.Outputs { .defaults }

// Audited for 6.5.4
private struct EnableVFDFeature: ViewGraphFeature {
func modifyViewInputs(inputs: inout _ViewInputs, graph: ViewGraph) {
inputs.base.options.insert(.supportsVariableFrameDuration)
}
}
}

extension _UIHostingView {
Expand Down
9 changes: 2 additions & 7 deletions Sources/OpenSwiftUICore/View/Graph/ViewGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ package final class ViewGraph: GraphHost {
package subscript<T>(feature: T.Type) -> UnsafeMutablePointer<T>? where T: ViewGraphFeature {
features[feature]
}

override package func instantiateOutputs() {
let outputs = globalSubgraph.apply {
// Audited for 6.5.4
var inputs = _ViewInputs(
graphInputs,
position: $position,
Expand All @@ -225,12 +226,6 @@ package final class ViewGraph: GraphHost {
preferenceBridge.wrapInputs(&inputs)
}
_ViewDebug.initialize(inputs: &inputs)
if _VariableFrameDurationIsSupported() {
inputs.base.options.formUnion(.supportsVariableFrameDuration)
}
if let delegate {
delegate.modifyViewInputs(&inputs)
}
if inputs.needsGeometry {
// inputs.makeRootMatchedGeometryScope()
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/OpenSwiftUI_SPI/Shims/UIKit/UIKit_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ OPENSWIFTUI_EXPORT
bool UIViewIgnoresTouchEvents(UIView *view);

OPENSWIFTUI_EXPORT
double UIAnimationDragCoefficient(void);
float UIAnimationDragCoefficient(void);

// MARK: - UIUpdate related private API from UIKitCore

OPENSWIFTUI_EXPORT
bool _UIUpdateAdaptiveRateNeeded();

OPENSWIFTUI_ASSUME_NONNULL_END

Expand Down