|
| 1 | +// |
| 2 | +// VariadicView_ImplicitRoot.swift |
| 3 | +// OpenSwiftUI |
| 4 | +// |
| 5 | +// Audited for RELEASE_2021 |
| 6 | +// Status: WIP |
| 7 | +// ID: 00F12C0E37A19C593ECA0DBD3BE26541 |
| 8 | + |
| 9 | +internal import OpenGraphShims |
| 10 | + |
| 11 | +/// A type of root that creates a `View` when its result builder is invoked with |
| 12 | +/// `View`. |
| 13 | +/// - SeeAlso: _VariadicView.ViewRoot. |
| 14 | +/// - Note: Requirements mirror `View`'s. |
| 15 | +public protocol _VariadicView_ViewRoot: _VariadicView_Root { |
| 16 | + associatedtype Body: View |
| 17 | + |
| 18 | + static func _makeView( |
| 19 | + root: _GraphValue<Self>, |
| 20 | + inputs: _ViewInputs, |
| 21 | + body: (_Graph, _ViewInputs) -> _ViewListOutputs |
| 22 | + ) -> _ViewOutputs |
| 23 | + |
| 24 | + static func _makeViewList( |
| 25 | + root: _GraphValue<Self>, |
| 26 | + inputs: _ViewListInputs, |
| 27 | + body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs |
| 28 | + ) -> _ViewListOutputs |
| 29 | + |
| 30 | + static func _viewListCount( |
| 31 | + inputs: _ViewListCountInputs, |
| 32 | + body: (_ViewListCountInputs) -> Int? |
| 33 | + ) -> Int? |
| 34 | + |
| 35 | + @ViewBuilder |
| 36 | + func body(children: _VariadicView.Children) -> Body |
| 37 | +} |
| 38 | + |
| 39 | +extension _VariadicView_ViewRoot { |
| 40 | + public static func _makeView( |
| 41 | + root: _GraphValue<Self>, |
| 42 | + inputs: _ViewInputs, |
| 43 | + body: (_Graph, _ViewInputs) -> _ViewListOutputs |
| 44 | + ) -> _ViewOutputs { |
| 45 | + fatalError("TODO") |
| 46 | + } |
| 47 | + |
| 48 | + public static func _makeViewList( |
| 49 | + root: _GraphValue<Self>, |
| 50 | + inputs: _ViewListInputs, |
| 51 | + body: @escaping (_Graph, _ViewListInputs) -> _ViewListOutputs |
| 52 | + ) -> _ViewListOutputs { |
| 53 | + fatalError("TODO") |
| 54 | + } |
| 55 | + |
| 56 | + public static func _viewListCount(inputs: _ViewListCountInputs) -> Int? { |
| 57 | + Body._viewListCount(inputs: inputs) |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | + |
| 62 | +// MARK: - ViewRootBody |
| 63 | + |
| 64 | +private struct ViewRootBody<Root> { |
| 65 | + @Attribute var root: Root |
| 66 | + @Attribute var list: ViewList |
| 67 | + let contentSubgraph: OGSubgraph |
| 68 | +} |
| 69 | + |
| 70 | +extension _ViewInputs { |
| 71 | + private struct ImplicitRootType: ViewInput { |
| 72 | + static let defaultValue: _VariadicView_AnyImplicitRoot.Type = _VStackLayout.self |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +extension View { |
| 77 | + static func makeImplicitRoot(view: _GraphValue<Self>, inputs: _ViewInputs) -> _ViewOutputs { |
| 78 | + // TODO |
| 79 | + return .init() |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +// TODO: ViewModifier |
0 commit comments