Skip to content

Commit 84d5802

Browse files
authored
Implement ConditionContent._makeView (#79)
1 parent 71ba777 commit 84d5802

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

Sources/OpenSwiftUI/Core/Semantic/SemanticFeature.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ extension SemanticFeature {
2222
}
2323

2424
struct _SemanticFeature_v2: SemanticFeature {
25-
static var introduced: Semantics { .v2_3 }
25+
static var introduced: Semantics { .v2 }
2626
}
2727

2828
struct _SemanticFeature_v3: SemanticFeature {
29-
static var introduced: Semantics { .v3_2 }
29+
static var introduced: Semantics { .v3 }
3030
}

Sources/OpenSwiftUI/Core/View/TODO/_ConditionalContent.swift renamed to Sources/OpenSwiftUI/Core/View/ConditionalContent.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//
2-
// _ConditionalContent.swift
2+
// ConditionalContent.swift
33
// OpenSwiftUI
44
//
5-
// Updated by Kyle on 2023/10/8.
65
// Audited for RELEASE_2021
76
// Status: WIP
87
// ID: 1A625ACC143FD8524C590782FD8F4F8C
@@ -27,13 +26,23 @@ extension _ConditionalContent: View, PrimitiveView where TrueContent: View, Fals
2726
init(storage: Storage) {
2827
self.storage = storage
2928
}
30-
// public static func _makeView(view: _GraphValue<_ConditionalContent<TrueContent, FalseContent>>, inputs: _ViewInputs) -> _ViewOutputs
29+
30+
public static func _makeView(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs {
31+
if _SemanticFeature_v2.isEnable {
32+
return makeImplicitRoot(view: view, inputs: inputs)
33+
} else {
34+
return AnyView._makeView(
35+
view: _GraphValue(ChildView(content: view.value)),
36+
inputs: inputs
37+
)
38+
}
39+
}
40+
3141
// public static func _makeViewList(view: _GraphValue<_ConditionalContent<TrueContent, FalseContent>>, inputs: _ViewListInputs) -> _ViewListOutputs
3242
// public static func _viewListCount(inputs: _ViewListCountInputs) -> Swift.Int?
3343

34-
private struct ChildView {
35-
@Attribute
36-
var content: _ConditionalContent
44+
private struct ChildView: Rule, AsyncAttribute {
45+
@Attribute var content: _ConditionalContent
3746

3847
let ids: (UniqueID, UniqueID)
3948

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// ViewRoot.swift
3+
// OpenSwiftUI
4+
//
5+
// Audited for RELEASE_2021
6+
// Status: WIP
7+
// ID: 00F12C0E37A19C593ECA0DBD3BE26541
8+
9+
extension View {
10+
static func makeImplicitRoot(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs {
11+
// TODO
12+
return .init()
13+
}
14+
}

Sources/OpenSwiftUI/Data/Environment/Environment.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ public struct Environment<Value>: DynamicProperty {
251251
}
252252

253253
private struct EnvironmentBox<Value>: DynamicPropertyBox {
254-
@Attribute<EnvironmentValues>
255-
var environment: EnvironmentValues
254+
@Attribute var environment: EnvironmentValues
256255
var keyPath: KeyPath<EnvironmentValues, Value>?
257256
var value: Value?
258257

0 commit comments

Comments
 (0)