Skip to content

Update Graph to Release 2024 #126

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 7 commits into from
Oct 1, 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 Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ internal import OpenGraphShims
// TODO: PlatformViewChild in _A513612C07DFA438E70B9FA90719B40D

protocol InvalidatableAttribute: _AttributeBody {
static func willInvalidate(attribute: OGAttribute)
static func willInvalidate(attribute: AnyAttribute)
}
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
internal import OpenGraphShims

protocol RemovableAttribute: _AttributeBody {
static func willRemove(attribute: OGAttribute)
static func didReinsert(attribute: OGAttribute)
static func willRemove(attribute: AnyAttribute)
static func didReinsert(attribute: AnyAttribute)
}
6 changes: 3 additions & 3 deletions Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal import OpenGraphShims

protocol BodyAccessorRule {
static var container: Any.Type { get }
static func value<Value>(as: Value.Type, attribute: OGAttribute) -> Value?
static func buffer<Value>(as: Value.Type, attribute: OGAttribute) -> _DynamicPropertyBuffer?
static func metaProperties<Value>(as: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)]
static func value<Value>(as: Value.Type, attribute: AnyAttribute) -> Value?
static func buffer<Value>(as: Value.Type, attribute: AnyAttribute) -> _DynamicPropertyBuffer?
static func metaProperties<Value>(as: Value.Type, attribute: AnyAttribute) -> [(String, AnyAttribute)]
}
9 changes: 0 additions & 9 deletions Sources/OpenSwiftUI/Core/Graph/Graph.swift

This file was deleted.

14 changes: 12 additions & 2 deletions Sources/OpenSwiftUI/Core/Graph/GraphDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
// GraphDelegate.swift
// OpenSwiftUI
//
// Audited for RELEASE_2021
// Audited for RELEASE_2024
// Status: Complete

//@_spi(ForOpenSwiftUIOnly)
/*public*/
protocol GraphDelegate: AnyObject {
func updateGraph<V>(body: (GraphHost) -> V) -> V
func updateGraph<T>(body: (GraphHost) -> T) -> T
func graphDidChange()
func preferencesDidChange()
func beginTransaction()
}

@_spi(ForOpenSwiftUIOnly)
extension GraphDelegate {
public func beginTransaction() {
// TODO
}
}
25 changes: 13 additions & 12 deletions Sources/OpenSwiftUI/Core/Graph/GraphHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GraphHost {

static var currentHost: GraphHost {
#if canImport(Darwin)
if let currentAttribute = OGAttribute.current {
if let currentAttribute = AnyAttribute.current {
currentAttribute.graph.graphHost()
} else if let currentSubgraph = OGSubgraph.current {
currentSubgraph.graph.graphHost()
Expand Down Expand Up @@ -138,7 +138,7 @@ class GraphHost {

// TODO: _ArchivedViewHost.reset()
final func incrementPhase() {
data.phase.value += 2
// data.phase.value += 2
graphDelegate?.graphDidChange()
}

Expand Down Expand Up @@ -231,7 +231,7 @@ class GraphHost {
// TODO:
}

final func graphInvalidation(from attribute: OGAttribute?) {
final func graphInvalidation(from attribute: AnyAttribute?) {
#if canImport(Darwin)
guard let attribute else {
graphDelegate?.graphDidChange()
Expand All @@ -246,7 +246,7 @@ class GraphHost {
asyncTransaction(
transaction,
mutation: EmptyGraphMutation(),
style: ._1,
style: .deferred,
mayDeferUpdate: true
)
}
Expand Down Expand Up @@ -289,8 +289,8 @@ class GraphHost {
guard let parent = host.parentHost else {
asyncTransaction(
Transaction(),
mutation: CustomGraphMutation(body: body),
style: ._1,
mutation: CustomGraphMutation(body),
style: .deferred,
mayDeferUpdate: true
)
return
Expand Down Expand Up @@ -338,12 +338,13 @@ extension GraphHost {
_phase = phase
_hostPreferenceKeys = hostPreferenceKeys
_transaction = transaction
inputs = _GraphInputs(
time: time,
cachedEnvironment: cachedEnvironment,
phase: phase,
transaction: transaction
)
// inputs = _GraphInputs(
// time: time,
// cachedEnvironment: cachedEnvironment,
// phase: phase,
// transaction: transaction
// )
fatalError("TODO")
}
}
}
Expand Down
8 changes: 0 additions & 8 deletions Sources/OpenSwiftUI/Core/Graph/GraphInput.swift

This file was deleted.

125 changes: 0 additions & 125 deletions Sources/OpenSwiftUI/Core/Graph/GraphInputs.swift

This file was deleted.

11 changes: 0 additions & 11 deletions Sources/OpenSwiftUI/Core/Graph/GraphInputsModifier.swift

This file was deleted.

55 changes: 0 additions & 55 deletions Sources/OpenSwiftUI/Core/Graph/GraphMutation.swift

This file was deleted.

51 changes: 0 additions & 51 deletions Sources/OpenSwiftUI/Core/Graph/GraphValue.swift

This file was deleted.

Loading
Loading