Skip to content

Commit 4b0bb2a

Browse files
committed
Update StaticBody
1 parent 089e31a commit 4b0bb2a

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
77
"state" : {
88
"branch" : "main",
9-
"revision" : "b4486fa4a1efffacae01a9df54c1545b1b6e0462"
9+
"revision" : "6133e9f737077b5c75ff33dee1c2c969cb5d91b4"
1010
}
1111
},
1212
{

Sources/OpenSwiftUI/DataAndStorage/ModelData/DynamicProperty/DynamicProperty.swift

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,16 @@ private protocol RuleThreadFlags {
106106
}
107107

108108
private struct AsyncThreadFlags: RuleThreadFlags {
109-
static var value: OGAttributeTypeFlags { .init(rawValue: 1 << 5) }
109+
static var value: OGAttributeTypeFlags { .asyncThread }
110110
}
111111

112112
private struct MainThreadFlags: RuleThreadFlags {
113-
static var value: OGAttributeTypeFlags { ._8 }
113+
static var value: OGAttributeTypeFlags { .mainThread }
114114
}
115115

116-
117116
// MARK: - StaticBody
118117

119-
private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>: CustomStringConvertible, BodyAccessorRule/*, StatefulRule*/ {
118+
private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags> {
120119
let accessor: Accessor
121120
@Attribute
122121
var container: Accessor.Container
@@ -125,19 +124,23 @@ private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>:
125124
self.accessor = accessor
126125
self._container = container
127126
}
128-
127+
}
128+
129+
extension StaticBody: StatefulRule {
130+
typealias Value = Accessor.Body
131+
129132
func updateValue() {
130133
accessor.updateBody(of: container, changed: true)
131134
}
132-
133-
var description: String {
134-
"\(Accessor.Body.self)"
135-
}
136-
135+
}
136+
137+
extension StaticBody: _AttributeBody {
137138
static var flags: OGAttributeTypeFlags {
138139
ThreadFlags.value
139140
}
140-
141+
}
142+
143+
extension StaticBody: BodyAccessorRule {
141144
static var container: Any.Type {
142145
Accessor.Container.self
143146
}
@@ -160,3 +163,7 @@ private struct StaticBody<Accessor: BodyAccessor, ThreadFlags: RuleThreadFlags>:
160163
return [("@self", attribute.info.body.assumingMemoryBound(to: Self.self).pointee._container.identifier)]
161164
}
162165
}
166+
167+
extension StaticBody: CustomStringConvertible {
168+
var description: String { "\(Accessor.Body.self)" }
169+
}

0 commit comments

Comments
 (0)