@@ -186,62 +186,3 @@ struct ClearDebugLayoutLog: Layout {
186
186
subviews [ 0 ] . place ( at: bounds. origin, proposal: proposal)
187
187
}
188
188
}
189
-
190
- @available ( macOS 13 . 0 , iOS 16 . 0 , tvOS 16 . 0 , watchOS 9 . 0 , * )
191
- public final class LogStore : ObservableObject {
192
- @Published public var log : [ LogEntry ]
193
- var viewLabels : Set < String > = [ ]
194
-
195
- init ( log: [ LogEntry ] = [ ] ) {
196
- self . log = log
197
- self . viewLabels = Set ( log. map ( \. label) )
198
- }
199
-
200
- func registerViewLabelAndWarnIfNotUnique( _ label: String , file: StaticString , line: UInt ) {
201
- DispatchQueue . main. async { [ self ] in
202
- if viewLabels. contains ( label) {
203
- let message : StaticString = " %@:%llu: Duplicate view label '%@' detected. Use unique labels in .layoutStep() calls "
204
- runtimeWarning ( message, [ String ( describing: file) , UInt64 ( line) , label] , file: file, line: line)
205
- }
206
- viewLabels. insert ( label)
207
- }
208
- }
209
-
210
- func logLayoutStep( _ label: String , step: LogEntry . Step ) {
211
- DispatchQueue . main. async { [ self ] in
212
- guard let prevEntry = log. last else {
213
- // First log entry → start at indent 0.
214
- log. append ( LogEntry ( label: label, step: step, indent: 0 ) )
215
- return
216
- }
217
-
218
- var newEntry = LogEntry ( label: label, step: step, indent: prevEntry. indent)
219
- let isSameView = prevEntry. label == label
220
- switch ( isSameView, prevEntry. step, step) {
221
- case ( true , . proposal( let prop) , . response( let resp) ) :
222
- // Response follows immediately after proposal for the same view.
223
- // → We want to display them in a single row.
224
- // → Coalesce both layout steps.
225
- log. removeLast ( )
226
- newEntry = prevEntry
227
- newEntry. step = . proposalAndResponse( proposal: prop, response: resp)
228
- log. append ( newEntry)
229
-
230
- case ( _, . proposal, . proposal) :
231
- // A proposal follows a proposal → nested view → increment indent.
232
- newEntry. indent += 1
233
- log. append ( newEntry)
234
-
235
- case ( _, . response, . response) ,
236
- ( _, . proposalAndResponse, . response) :
237
- // A response follows a response → last child returns to parent → decrement indent.
238
- newEntry. indent -= 1
239
- log. append ( newEntry)
240
-
241
- default :
242
- // Keep current indentation.
243
- log. append ( newEntry)
244
- }
245
- }
246
- }
247
- }
0 commit comments