Skip to content

Commit 59b9ce4

Browse files
committed
Bump OG version and update API
1 parent b4deb35 commit 59b9ce4

File tree

17 files changed

+50
-50
lines changed

17 files changed

+50
-50
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/OpenSwiftUI/Core/Attribute/InvalidatableAttribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ internal import OpenGraphShims
1010
// TODO: PlatformViewChild in _A513612C07DFA438E70B9FA90719B40D
1111

1212
protocol InvalidatableAttribute: _AttributeBody {
13-
static func willInvalidate(attribute: OGAttribute)
13+
static func willInvalidate(attribute: AnyAttribute)
1414
}

Sources/OpenSwiftUI/Core/Attribute/RemovableAttribute.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
internal import OpenGraphShims
99

1010
protocol RemovableAttribute: _AttributeBody {
11-
static func willRemove(attribute: OGAttribute)
12-
static func didReinsert(attribute: OGAttribute)
11+
static func willRemove(attribute: AnyAttribute)
12+
static func didReinsert(attribute: AnyAttribute)
1313
}

Sources/OpenSwiftUI/Core/BodyAccessor/BodyAccessorRule.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal import OpenGraphShims
99

1010
protocol BodyAccessorRule {
1111
static var container: Any.Type { get }
12-
static func value<Value>(as: Value.Type, attribute: OGAttribute) -> Value?
13-
static func buffer<Value>(as: Value.Type, attribute: OGAttribute) -> _DynamicPropertyBuffer?
14-
static func metaProperties<Value>(as: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)]
12+
static func value<Value>(as: Value.Type, attribute: AnyAttribute) -> Value?
13+
static func buffer<Value>(as: Value.Type, attribute: AnyAttribute) -> _DynamicPropertyBuffer?
14+
static func metaProperties<Value>(as: Value.Type, attribute: AnyAttribute) -> [(String, AnyAttribute)]
1515
}

Sources/OpenSwiftUI/Core/Graph/GraphHost.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GraphHost {
3030

3131
static var currentHost: GraphHost {
3232
#if canImport(Darwin)
33-
if let currentAttribute = OGAttribute.current {
33+
if let currentAttribute = AnyAttribute.current {
3434
currentAttribute.graph.graphHost()
3535
} else if let currentSubgraph = OGSubgraph.current {
3636
currentSubgraph.graph.graphHost()
@@ -231,7 +231,7 @@ class GraphHost {
231231
// TODO:
232232
}
233233

234-
final func graphInvalidation(from attribute: OGAttribute?) {
234+
final func graphInvalidation(from attribute: AnyAttribute?) {
235235
#if canImport(Darwin)
236236
guard let attribute else {
237237
graphDelegate?.graphDidChange()

Sources/OpenSwiftUI/Core/Graph/GraphInputs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public struct _GraphInputs {
1111
private var changedDebugProperties: _ViewDebug.Properties
1212
private var options: _GraphInputs.Options
1313
#if canImport(Darwin) // FIXME: See #39
14-
var mergedInputs: Set<OGAttribute>
14+
var mergedInputs: Set<AnyAttribute>
1515
#endif
1616

1717
#if canImport(Darwin)
@@ -22,7 +22,7 @@ public struct _GraphInputs {
2222
transaction: Attribute<Transaction>,
2323
changedDebugProperties: _ViewDebug.Properties = [],
2424
options: _GraphInputs.Options = [],
25-
mergedInputs: Set<OGAttribute> = []) {
25+
mergedInputs: Set<AnyAttribute> = []) {
2626
self.customInputs = customInputs
2727
self.time = time
2828
self.cachedEnvironment = cachedEnvironment
@@ -40,7 +40,7 @@ public struct _GraphInputs {
4040
transaction: Attribute<Transaction>,
4141
changedDebugProperties: _ViewDebug.Properties = [],
4242
options: _GraphInputs.Options = []/*,
43-
mergedInputs: Set<OGAttribute> = []*/) {
43+
mergedInputs: Set<AnyAttribute> = []*/) {
4444
self.customInputs = customInputs
4545
self.time = time
4646
self.cachedEnvironment = cachedEnvironment

Sources/OpenSwiftUI/Core/View/View/ViewList.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ package struct _ViewList_ID {
191191
private struct Explicit: Equatable {
192192
let id: AnyHashable
193193
#if canImport(Darwin)
194-
let owner: OGAttribute
194+
let owner: AnyAttribute
195195
#endif
196196
let isUnary: Bool
197197
}
@@ -203,7 +203,7 @@ package struct _ViewList_ID {
203203
}
204204

205205
#if canImport(Darwin)
206-
mutating func bind(explicitID: AnyHashable, owner: OGAttribute, isUnary: Bool) {
206+
mutating func bind(explicitID: AnyHashable, owner: AnyAttribute, isUnary: Bool) {
207207
explicitIDs.append(.init(id: explicitID, owner: owner, isUnary: isUnary))
208208
}
209209
#endif
@@ -226,7 +226,7 @@ final package class _ViewList_IndirectMap {
226226
final package let subgraph: OGSubgraph
227227

228228
#if canImport(Darwin)
229-
final package var map: [OGAttribute: OGAttribute]
229+
final package var map: [AnyAttribute: AnyAttribute]
230230
#endif
231231

232232
init(subgraph: OGSubgraph) {

Sources/OpenSwiftUI/Core/View/View/ViewOutputs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public struct _ViewOutputs {
3030
func detachIndirectOutputs() {
3131
#if canImport(Darwin)
3232
struct ResetPreference: PreferenceKeyVisitor {
33-
var dst: OGAttribute
33+
var dst: AnyAttribute
3434
func visit<Key: PreferenceKey>(key: Key.Type) {
3535
let graphHost = dst.graph.graphHost()
3636
let source = graphHost.intern(Key.defaultValue, id: .zero)
@@ -63,7 +63,7 @@ public struct _ViewOutputs {
6363
@inline(__always)
6464
func forEach(body: (
6565
_ key: AnyPreferenceKey.Type,
66-
_ value: OGAttribute
66+
_ value: AnyAttribute
6767
) throws -> Void
6868
) rethrows {
6969
try preferences.forEach(body: body)

Sources/OpenSwiftUI/Core/View/ViewGraph.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ final class ViewGraph: GraphHost {
1515
static var current: ViewGraph { GraphHost.currentHost as! ViewGraph }
1616

1717
let rootViewType: Any.Type
18-
let makeRootView: (OGAttribute, _ViewInputs) -> _ViewOutputs
18+
let makeRootView: (AnyAttribute, _ViewInputs) -> _ViewOutputs
1919
weak var delegate: ViewGraphDelegate?
2020
var centersRootView: Bool = true
21-
let rootView: OGAttribute
21+
let rootView: AnyAttribute
2222
@Attribute var rootTransform: ViewTransform
2323
@Attribute var zeroPoint: ViewOrigin
2424
// TODO
@@ -53,7 +53,7 @@ final class ViewGraph: GraphHost {
5353
set { setPreferenceBridge(to: newValue, isInvalidating: false) }
5454
}
5555
#if canImport(Darwin) // FIXME: See #39
56-
var bridgedPreferences: [(AnyPreferenceKey.Type, OGAttribute)] = []
56+
var bridgedPreferences: [(AnyPreferenceKey.Type, AnyAttribute)] = []
5757
#endif
5858
// TODO
5959

Sources/OpenSwiftUI/Data/Environment/CachedEnvironment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct CachedEnvironment {
1414
var environment: Attribute<EnvironmentValues>
1515
private var items: [Item]
1616
#if canImport(Darwin)
17-
private var constants: [HashableConstant: OGAttribute]
17+
private var constants: [HashableConstant: AnyAttribute]
1818
#endif
1919
private var animatedFrame: AnimatedFrame?
2020
// private var resolvedFgStyles: [ResolvedFgStyle : Swift<_ShapeStyle_Resolved.ResolvedFg>]
@@ -73,7 +73,7 @@ extension CachedEnvironment {
7373
private struct Item {
7474
var key: PartialKeyPath<EnvironmentValues>
7575
#if canImport(Darwin) // See #39
76-
var value: OGAttribute
76+
var value: AnyAttribute
7777
#endif
7878
}
7979
}

Sources/OpenSwiftUI/Data/Model/DynamicProperty/DynamicProperty.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ extension StaticBody: BodyAccessorRule {
179179
Accessor.Container.self
180180
}
181181

182-
static func value<Value>(as _: Value.Type, attribute: OGAttribute) -> Value? {
182+
static func value<Value>(as _: Value.Type, attribute: AnyAttribute) -> Value? {
183183
guard container == Value.self else {
184184
return nil
185185
}
186186
return unsafeBitCast(attribute.info.body.assumingMemoryBound(to: Self.self).pointee.container, to: Value.self)
187187
}
188188

189-
static func buffer<Value>(as _: Value.Type, attribute _: OGAttribute) -> _DynamicPropertyBuffer? {
189+
static func buffer<Value>(as _: Value.Type, attribute _: AnyAttribute) -> _DynamicPropertyBuffer? {
190190
nil
191191
}
192192

193-
static func metaProperties<Value>(as _: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)] {
193+
static func metaProperties<Value>(as _: Value.Type, attribute: AnyAttribute) -> [(String, AnyAttribute)] {
194194
guard container == Value.self else {
195195
return []
196196
}
@@ -253,21 +253,21 @@ extension DynamicBody: BodyAccessorRule {
253253
Accessor.Container.self
254254
}
255255

256-
static func value<Value>(as _: Value.Type, attribute: OGAttribute) -> Value? {
256+
static func value<Value>(as _: Value.Type, attribute: AnyAttribute) -> Value? {
257257
guard container == Value.self else {
258258
return nil
259259
}
260260
return unsafeBitCast(attribute.info.body.assumingMemoryBound(to: Self.self).pointee.container, to: Value.self)
261261
}
262262

263-
static func buffer<Value>(as _: Value.Type, attribute: OGAttribute) -> _DynamicPropertyBuffer? {
263+
static func buffer<Value>(as _: Value.Type, attribute: AnyAttribute) -> _DynamicPropertyBuffer? {
264264
guard container == Value.self else {
265265
return nil
266266
}
267267
return attribute.info.body.assumingMemoryBound(to: Self.self).pointee.links
268268
}
269269

270-
static func metaProperties<Value>(as _: Value.Type, attribute: OGAttribute) -> [(String, OGAttribute)] {
270+
static func metaProperties<Value>(as _: Value.Type, attribute: AnyAttribute) -> [(String, AnyAttribute)] {
271271
guard container == Value.self else {
272272
return []
273273
}

Sources/OpenSwiftUI/Data/Preference/PreferenceBridge.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ final class PreferenceBridge {
1919

2020
struct BridgedPreference {
2121
var key: AnyPreferenceKey.Type
22-
var combiner: OGWeakAttribute
22+
var combiner: AnyWeakAttribute
2323
}
2424

2525
init() {
2626
viewGraph = GraphHost.currentHost as! ViewGraph
2727
}
2828

2929
#if canImport(Darwin) // FIXME: See #39
30-
func addValue(_ value: OGAttribute, for keyType: AnyPreferenceKey.Type) {
30+
func addValue(_ value: AnyAttribute, for keyType: AnyPreferenceKey.Type) {
3131
struct AddValue: PreferenceKeyVisitor {
32-
var combiner: OGAttribute
33-
var value: OGAttribute
32+
var combiner: AnyAttribute
33+
var value: AnyAttribute
3434
func visit<Key: PreferenceKey>(key _: Key.Type) {
3535
combiner.mutateBody(
3636
as: PreferenceCombiner<Key>.self,
3737
invalidating: true
3838
) { combiner in
39-
combiner.attributes.append(WeakAttribute(base: OGWeakAttribute(value)))
39+
combiner.attributes.append(WeakAttribute(base: AnyWeakAttribute(value)))
4040
}
4141
}
4242
}
@@ -51,10 +51,10 @@ final class PreferenceBridge {
5151
viewGraph.graphInvalidation(from: value)
5252
}
5353

54-
func removeValue(_ value: OGAttribute, for keyType: AnyPreferenceKey.Type, isInvalidating: Bool) {
54+
func removeValue(_ value: AnyAttribute, for keyType: AnyPreferenceKey.Type, isInvalidating: Bool) {
5555
struct RemoveValue: PreferenceKeyVisitor {
56-
var combiner: OGAttribute
57-
var value: OGAttribute
56+
var combiner: AnyAttribute
57+
var value: AnyAttribute
5858
var changed = false
5959
mutating func visit<Key: PreferenceKey>(key _: Key.Type) {
6060
combiner.mutateBody(
@@ -149,7 +149,7 @@ final class PreferenceBridge {
149149

150150
func wrapOutputs(_ outputs: inout PreferencesOutputs, inputs: _ViewInputs) {
151151
struct MakeCombiner: PreferenceKeyVisitor {
152-
var result: OGAttribute?
152+
var result: AnyAttribute?
153153

154154
mutating func visit<Key>(key _: Key.Type) where Key: PreferenceKey {
155155
result = Attribute(PreferenceCombiner<Key>(attributes: [])).identifier
@@ -178,7 +178,7 @@ final class PreferenceBridge {
178178
if !requestedPreferences.contains(key) {
179179
requestedPreferences.add(key)
180180
}
181-
bridgedPreferences.append(BridgedPreference(key: key, combiner: OGWeakAttribute(combiner)))
181+
bridgedPreferences.append(BridgedPreference(key: key, combiner: AnyWeakAttribute(combiner)))
182182
outputs[anyKey: key] = combiner
183183
}
184184
}

Sources/OpenSwiftUI/Data/Preference/PreferencesOutputs.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct PreferencesOutputs {
3131
}
3232
}
3333

34-
subscript(anyKey keyType: AnyPreferenceKey.Type) -> OGAttribute? {
34+
subscript(anyKey keyType: AnyPreferenceKey.Type) -> AnyAttribute? {
3535
get { preferences.first { $0.key == keyType }?.value }
3636
set {
3737
if keyType == _AnyPreferenceKey<DisplayList.Key>.self {
@@ -56,7 +56,7 @@ struct PreferencesOutputs {
5656
@inline(__always)
5757
func forEach(body: (
5858
_ key: AnyPreferenceKey.Type,
59-
_ value: OGAttribute
59+
_ value: AnyAttribute
6060
) throws -> Void
6161
) rethrows {
6262
try preferences.forEach { try body($0.key, $0.value) }
@@ -65,9 +65,9 @@ struct PreferencesOutputs {
6565
@inline(__always)
6666
func first(where predicate: (
6767
_ key: AnyPreferenceKey.Type,
68-
_ value: OGAttribute
68+
_ value: AnyAttribute
6969
) throws -> Bool
70-
) rethrows -> (key: AnyPreferenceKey.Type, value: OGAttribute)? {
70+
) rethrows -> (key: AnyPreferenceKey.Type, value: AnyAttribute)? {
7171
try preferences
7272
.first { try predicate($0.key, $0.value) }
7373
.map { ($0.key, $0.value) }
@@ -91,7 +91,7 @@ extension PreferencesOutputs {
9191
private struct KeyValue {
9292
var key: AnyPreferenceKey.Type
9393
#if canImport(Darwin) // FIXME: See #39
94-
var value: OGAttribute
94+
var value: AnyAttribute
9595
#endif
9696
}
9797
}

Sources/OpenSwiftUI/View/Debug/ChangedBodyProperty.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func changedBodyProperties<Body>(of type: Body.Type) -> [String] {
164164
continue
165165
}
166166
var properties: [String] = []
167-
let attribute = OGAttribute(rawValue: nodeID)
167+
let attribute = AnyAttribute(rawValue: nodeID)
168168
let metaProperties = selfType.metaProperties(as: type, attribute: attribute)
169169
if !metaProperties.isEmpty, let inputs = dict["inputs"] as? [[String: Any]] {
170170
for metaProperty in metaProperties {

Sources/OpenSwiftUI/View/Modifier/AppearanceActionModifier.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extension AppearanceEffect: StatefulRule {
101101
// MARK: AppearanceEffect + RemovableAttribute
102102

103103
extension AppearanceEffect: RemovableAttribute {
104-
static func willRemove(attribute: OGAttribute) {
104+
static func willRemove(attribute: AnyAttribute) {
105105
let appearancePointer = UnsafeMutableRawPointer(mutating: attribute.info.body)
106106
.assumingMemoryBound(to: AppearanceEffect.self)
107107
guard appearancePointer.pointee.lastValue != nil else {
@@ -110,7 +110,7 @@ extension AppearanceEffect: RemovableAttribute {
110110
appearancePointer.pointee.disappeared()
111111
}
112112

113-
static func didReinsert(attribute: OGAttribute) {
113+
static func didReinsert(attribute: AnyAttribute) {
114114
let appearancePointer = UnsafeMutableRawPointer(mutating: attribute.info.body)
115115
.assumingMemoryBound(to: AppearanceEffect.self)
116116
guard let nodeAttribute = appearancePointer.pointee.node.attribute else {

Sources/OpenSwiftUI/View/View/AnyView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private struct AnyViewContainer: StatefulRule, AsyncAttribute {
191191

192192
func makeItem(_ storage: AnyViewStorageBase, uniqueId: UInt32) -> AnyViewInfo {
193193
#if canImport(Darwin)
194-
let current = OGAttribute.current!
194+
let current = AnyAttribute.current!
195195
let childGraph = OGSubgraph(graph: parentSubgraph.graph)
196196
parentSubgraph.addChild(childGraph)
197197
return childGraph.apply {
@@ -268,15 +268,15 @@ private struct AnyViewList: StatefulRule, AsyncAttribute {
268268
final class Item: _ViewList_Subgraph {
269269
let type: Any.Type
270270
#if canImport(Darwin)
271-
let owner: OGAttribute
271+
let owner: AnyAttribute
272272
#endif
273273
@Attribute var list: ViewList
274274
let id: UniqueID
275275
let isUnary: Bool
276276
let allItems: MutableBox<[Unmanaged<Item>]>
277277

278278
#if canImport(Darwin)
279-
init(type: Any.Type, owner: OGAttribute, list: Attribute<ViewList>, id: UniqueID, isUnary: Bool, subgraph: OGSubgraph, allItems: MutableBox<[Unmanaged<Item>]>) {
279+
init(type: Any.Type, owner: AnyAttribute, list: Attribute<ViewList>, id: UniqueID, isUnary: Bool, subgraph: OGSubgraph, allItems: MutableBox<[Unmanaged<Item>]>) {
280280
self.type = type
281281
self.owner = owner
282282
_list = list

Sources/OpenSwiftUICore/Graph/GraphMutation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ package struct CustomGraphMutation: GraphMutation {
4646
// FIXME: #39
4747
#if canImport(Darwin)
4848
struct InvalidatingGraphMutation: GraphMutation {
49-
let attribute: OGWeakAttribute
49+
let attribute: AnyWeakAttribute
5050

5151
func apply() {
5252
attribute.attribute?.invalidateValue()

0 commit comments

Comments
 (0)