@@ -19,7 +19,7 @@ struct DebugLayoutWrapper: ViewModifier {
19
19
func body( content: Content ) -> some View {
20
20
let isSelected = label == selection
21
21
content
22
- . border ( isSelected ? Color . blue : . clear, width: 2 )
22
+ . border ( isSelected ? Color . pink : . clear, width: 2 )
23
23
}
24
24
}
25
25
@@ -156,7 +156,7 @@ struct Selection<Value: Equatable>: PreferenceKey {
156
156
157
157
struct ConsoleView : View {
158
158
@ObservedObject var console = Console . shared
159
- @State private var selection : String ? = nil
159
+ @State private var selection : String ? = " Text "
160
160
161
161
var body : some View {
162
162
ScrollView ( . vertical) {
@@ -167,49 +167,47 @@ struct ConsoleView: View {
167
167
. padding ( . horizontal, 8 )
168
168
169
169
Grid ( alignment: . leadingFirstTextBaseline, horizontalSpacing: 0 , verticalSpacing: 0 ) {
170
+ GridRow {
171
+ Text ( " View " )
172
+ Text ( " Proposal " )
173
+ Text ( " Response " )
174
+ }
175
+ . font ( . headline)
176
+ . padding ( . vertical, 4 )
177
+ . padding ( . horizontal, 8 )
178
+
179
+ Rectangle ( ) . fill ( . secondary)
180
+ . frame ( height: 1 )
181
+ . gridCellUnsizedAxes ( . horizontal)
182
+ . padding ( . vertical, 4 )
183
+ . padding ( . horizontal, 8 )
184
+
170
185
ForEach ( console. log) { item in
171
186
let isSelected = selection == item. label
172
187
GridRow {
173
188
Text ( item. label)
174
- . frame ( maxWidth: . infinity, alignment: . leading)
175
- . padding ( . horizontal, 8 )
176
-
177
- if let proposal = item. proposal {
178
- Text ( " P " )
179
- . font ( . headline)
180
-
181
- Text ( proposal. pretty)
182
- . monospacedDigit ( )
183
- . gridColumnAlignment ( . trailing)
184
- . padding ( . horizontal, 8 )
185
- } else {
186
- Text ( " " )
187
- Text ( " " )
188
- }
189
-
190
- if let response = item. response {
191
- Text ( " ⇒ " )
192
- . font ( . headline)
193
-
194
- Text ( response. pretty)
195
- . monospacedDigit ( )
196
- . gridColumnAlignment ( . trailing)
197
- . padding ( . horizontal, 8 )
198
- } else {
199
- Text ( " " )
200
- Text ( " " )
201
- }
189
+ . font ( . body)
190
+ . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . leading)
191
+
192
+ Text ( item. proposal? . pretty ?? " … " )
193
+ . monospacedDigit ( )
194
+ . fixedSize ( )
195
+ . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . leading)
196
+
197
+ Text ( item. response? . pretty ?? " … " )
198
+ . monospacedDigit ( )
199
+ . fixedSize ( )
200
+ . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . leading)
202
201
}
203
- . padding ( . vertical, 8 )
202
+ . font ( . callout)
203
+ . padding ( . vertical, 4 )
204
+ . padding ( . horizontal, 8 )
204
205
. foregroundColor ( isSelected ? . white : nil )
205
206
. background ( isSelected ? Color . accentColor : . clear)
206
207
. contentShape ( Rectangle ( ) )
207
208
. onTapGesture {
208
209
selection = isSelected ? nil : item. label
209
210
}
210
-
211
- Divider ( )
212
- . gridCellUnsizedAxes ( . horizontal)
213
211
}
214
212
}
215
213
}
0 commit comments