Skip to content

Update dynamic property #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 6, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
release: [2024]
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
ios-simulator-name: "iPhone 16 Pro"
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
ios-simulator-name: "iPhone 16 Pro"
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
release: [2021, 2024]
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 1
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
continue-on-error: true
runs-on: ubuntu-22.04
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
continue-on-error: true
runs-on: ${{ matrix.os }}
env:
OPENSWIFTUI_WERROR: 0
OPENSWIFTUI_WERROR: 1
OPENGRAPH_ATTRIBUTEGRAPH: 0
OPENSWIFTUI_COMPATIBILITY_TEST: 0
OPENSWIFTUI_SWIFT_LOG: 1
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/App/AppGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import WASILibc
internal import OpenGraphShims
@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore

final class AppGraph: GraphHost {
package final class AppGraph: GraphHost {
static var shared: AppGraph? = nil
static var delegateBox: AnyFallbackDelegateBox? = nil

Expand Down
2 changes: 2 additions & 0 deletions Sources/OpenSwiftUI/Core/Render/DisplayLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import UIKit
import AppKit
#endif

@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore

final class DisplayLink: NSObject {
private weak var host: AnyUIHostingView?
private var link: CADisplayLink?
Expand Down
14 changes: 7 additions & 7 deletions Sources/OpenSwiftUI/Core/View/ViewGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import Foundation
@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore

final class ViewGraph: GraphHost {
package final class ViewGraph: GraphHost {
@inline(__always)
static var current: ViewGraph { GraphHost.currentHost as! ViewGraph }

Expand Down Expand Up @@ -190,13 +190,13 @@

// MARK: - Override Methods

override var graphDelegate: GraphDelegate? { delegate }
override var parentHost: GraphHost? {
override package var graphDelegate: GraphDelegate? { delegate }
override package var parentHost: GraphHost? {

Check warning on line 194 in Sources/OpenSwiftUI/Core/View/ViewGraph.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraph.swift#L193-L194

Added lines #L193 - L194 were not covered by tests
// TODO: _preferenceBridge
nil
}

override func instantiateOutputs() {
override package func instantiateOutputs() {

Check warning on line 199 in Sources/OpenSwiftUI/Core/View/ViewGraph.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraph.swift#L199

Added line #L199 was not covered by tests
#if canImport(Darwin)
let outputs = self.data.globalSubgraph.apply {
let graphInputs = graphInputs
Expand Down Expand Up @@ -241,7 +241,7 @@
#endif
}

override func uninstantiateOutputs() {
override package func uninstantiateOutputs() {

Check warning on line 244 in Sources/OpenSwiftUI/Core/View/ViewGraph.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraph.swift#L244

Added line #L244 was not covered by tests
#if canImport(Darwin)
removePreferenceOutlets(isInvalidating: false)
$rootGeometry.mutateBody(
Expand All @@ -260,11 +260,11 @@
#endif
}

override func timeDidChange() {
override package func timeDidChange() {

Check warning on line 263 in Sources/OpenSwiftUI/Core/View/ViewGraph.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraph.swift#L263

Added line #L263 was not covered by tests
nextUpdate.views = NextUpdate(time: .infinity)
}

override func isHiddenForReuseDidChange() {
override package func isHiddenForReuseDidChange() {

Check warning on line 267 in Sources/OpenSwiftUI/Core/View/ViewGraph.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraph.swift#L267

Added line #L267 was not covered by tests
// TODO
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/Core/View/ViewGraphDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
}

extension ViewGraphDelegate {
func updateGraph<V>(body: (GraphHost) -> V) -> V {
public func updateGraph<V>(body: (GraphHost) -> V) -> V {

Check warning on line 19 in Sources/OpenSwiftUI/Core/View/ViewGraphDelegate.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraphDelegate.swift#L19

Added line #L19 was not covered by tests
updateViewGraph(body: body)
}

func rootTransform() -> ViewTransform {
public func rootTransform() -> ViewTransform {

Check warning on line 23 in Sources/OpenSwiftUI/Core/View/ViewGraphDelegate.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Core/View/ViewGraphDelegate.swift#L23

Added line #L23 was not covered by tests
ViewTransform()
}
}

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 7 additions & 6 deletions Sources/OpenSwiftUI/Data/Preference/PreferenceBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,12 @@
@WeakAttribute var rhs: PreferenceKeys?

var value: PreferenceKeys {
var result = lhs
guard let rhs else {
return result
}
// result.merge(rhs)
return result
// var result = lhs
// guard let rhs else {
// return result
// }
// result.merge(rhs)
// return result
fatalError("TODO")

Check warning on line 201 in Sources/OpenSwiftUI/Data/Preference/PreferenceBridge.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUI/Data/Preference/PreferenceBridge.swift#L195-L201

Added lines #L195 - L201 were not covered by tests
}
}
13 changes: 12 additions & 1 deletion Sources/OpenSwiftUI/Export.swift
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
@_exported import OpenSwiftUICore
@_exported
@_spi(ForOpenSwiftUIOnly)
@_spi(Private)
@_spi(ClarityBoard)
@_spi(Testing)
@_spi(UIFrameworks)
@_spi(RemoteEffects)
@_spi(CustomHoverEffects)
@_spi(DisplayList_ViewSystem)
@_spi(SystemUI)
@_spi(DoNotImport)
import OpenSwiftUICore
3 changes: 3 additions & 0 deletions Sources/OpenSwiftUI/Integration/UIKit/AnyUIHostingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// Status: Complete

#if os(iOS)

@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore

protocol AnyUIHostingView: AnyObject {
func displayLinkTimer(timestamp: Time, isAsyncThread: Bool)
}
Expand Down
11 changes: 6 additions & 5 deletions Sources/OpenSwiftUI/Integration/UIKit/UIHostingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// ID: FAF0B683EB49BE9BABC9009857940A1E

#if os(iOS)
@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore
import UIKit

@available(macOS, unavailable)
Expand Down Expand Up @@ -102,7 +103,7 @@ open class _UIHostingView<Content>: UIView where Content: View {
if let displayLink, displayLink.willRender {
interval = .zero
} else {
interval = renderInterval(timestamp: .now) / UIAnimationDragCoefficient()
interval = renderInterval(timestamp: .systemUptime) / UIAnimationDragCoefficient()
}
render(interval: interval)
allowLayoutWhenNotVisible = false
Expand Down Expand Up @@ -136,11 +137,11 @@ open class _UIHostingView<Content>: UIView where Content: View {

private func renderInterval(timestamp: Time) -> Double {
if lastRenderTime == .zero || lastRenderTime > timestamp {
lastRenderTime = timestamp - .microseconds(1)
lastRenderTime = timestamp - 1e-6
}
let interval = timestamp - lastRenderTime
lastRenderTime = timestamp
return interval.seconds
return interval
}

// TODO
Expand Down Expand Up @@ -180,11 +181,11 @@ extension _UIHostingView: ViewRendererHost {
fatalError("TODO")
}

func graphDidChange() {
public func graphDidChange() {
// TODO
}

func preferencesDidChange() {
public func preferencesDidChange() {
// TODO
}

Expand Down
Loading
Loading