diff --git a/Package.resolved b/Package.resolved index d079f1a1..6f044af8 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "093c1851811a8423bb946386b7901adf094aa28258f12ae335ef9ee3a59018c7", + "originHash" : "b56337b3dd1894393ef8978297a221dd102010b985af35ef055a726c560435e6", "pins" : [ { "identity" : "opengraph", @@ -7,7 +7,7 @@ "location" : "https://github.com/OpenSwiftUIProject/OpenGraph", "state" : { "branch" : "main", - "revision" : "7f22fb5948bb6bc77603f5496a9881622041d3bb" + "revision" : "93e713f1357fc04ca917635d09460dbf42b663b6" } } ], diff --git a/Sources/OpenSwiftUI/Core/Attribute/InvalidatableAttribute.swift b/Sources/OpenSwiftUI/Core/Attribute/InvalidatableAttribute.swift index af23a01c..9940649e 100644 --- a/Sources/OpenSwiftUI/Core/Attribute/InvalidatableAttribute.swift +++ b/Sources/OpenSwiftUI/Core/Attribute/InvalidatableAttribute.swift @@ -10,5 +10,5 @@ internal import OpenGraphShims // TODO: PlatformViewChild in _A513612C07DFA438E70B9FA90719B40D protocol InvalidatableAttribute: _AttributeBody { - static func willInvalidate(attribute: OGAttribute) + static func willInvalidate(attribute: AnyAttribute) } diff --git a/Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift b/Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift index 21f54b4d..7b5f2a86 100644 --- a/Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift +++ b/Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift @@ -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) } diff --git a/Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift b/Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift index ee513ff0..10292b8b 100644 --- a/Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift +++ b/Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift @@ -9,7 +9,7 @@ internal import OpenGraphShims protocol BodyAccessorRule { static var container: Any.Type { get } - static func value(as: Value.Type, attribute: OGAttribute) -> Value? - static func buffer(as: Value.Type, attribute: OGAttribute) -> _DynamicPropertyBuffer? - static func metaProperties(as: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)] + static func value(as: Value.Type, attribute: AnyAttribute) -> Value? + static func buffer(as: Value.Type, attribute: AnyAttribute) -> _DynamicPropertyBuffer? + static func metaProperties(as: Value.Type, attribute: AnyAttribute) -> [(String, AnyAttribute)] } diff --git a/Sources/OpenSwiftUI/Core/Graph/Graph.swift b/Sources/OpenSwiftUI/Core/Graph/Graph.swift deleted file mode 100644 index b53be356..00000000 --- a/Sources/OpenSwiftUI/Core/Graph/Graph.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// Graph.swift -// OpenSwiftUI -// -// Audited for RELEASE_2021 -// Status: Complete - -/// A transient reference to a view graph. -public struct _Graph {} diff --git a/Sources/OpenSwiftUI/Core/Graph/GraphDelegate.swift b/Sources/OpenSwiftUI/Core/Graph/GraphDelegate.swift index 70725ace..b9476eda 100644 --- a/Sources/OpenSwiftUI/Core/Graph/GraphDelegate.swift +++ b/Sources/OpenSwiftUI/Core/Graph/GraphDelegate.swift @@ -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(body: (GraphHost) -> V) -> V + func updateGraph(body: (GraphHost) -> T) -> T func graphDidChange() func preferencesDidChange() + func beginTransaction() +} + +@_spi(ForOpenSwiftUIOnly) +extension GraphDelegate { + public func beginTransaction() { + // TODO + } } diff --git a/Sources/OpenSwiftUI/Core/Graph/GraphHost.swift b/Sources/OpenSwiftUI/Core/Graph/GraphHost.swift index 3a2efe61..a4f32b51 100644 --- a/Sources/OpenSwiftUI/Core/Graph/GraphHost.swift +++ b/Sources/OpenSwiftUI/Core/Graph/GraphHost.swift @@ -29,7 +29,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() @@ -230,7 +230,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() @@ -245,7 +245,7 @@ class GraphHost { asyncTransaction( transaction, mutation: EmptyGraphMutation(), - style: ._1, + style: .deferred, mayDeferUpdate: true ) } @@ -288,8 +288,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 diff --git a/Sources/OpenSwiftUI/Core/Graph/GraphInput.swift b/Sources/OpenSwiftUI/Core/Graph/GraphInput.swift index 3f342790..81845c7b 100644 --- a/Sources/OpenSwiftUI/Core/Graph/GraphInput.swift +++ b/Sources/OpenSwiftUI/Core/Graph/GraphInput.swift @@ -1,8 +1,141 @@ // -// GraphInput.swift -// OpenSwiftUI +// GraphInputs.swift +// OpenSwiftUICore // // Audited for RELEASE_2021 // Status: Complete -protocol GraphInput: PropertyKey {} +package protocol GraphInput: PropertyKey { + static var isTriviallyReusable: Swift.Bool { get } + static func makeReusable(indirectMap: IndirectAttributeMap, value: inout Value) + static func tryToReuse(_ value: Value, by other: Value, indirectMap: IndirectAttributeMap, testOnly: Bool) -> Bool +} + +internal import OpenGraphShims + +public struct _GraphInputs { + var customInputs: PropertyList + var time: Attribute