File tree 1 file changed +0
-35
lines changed
1 file changed +0
-35
lines changed Original file line number Diff line number Diff line change 1
1
# SwiftUI Layout Inspector Demo App
2
-
3
- ## Instructions
4
-
5
- 1 . Edit the ` subject: some View ` property in ` ContentView ` . It should contain
6
- the view tree you want to inspect.
7
-
8
- 2 . Add ` .debugLayout() ` at each point in the view tree where you want to
9
- inspect the layout algorithm (what sizes are being proposed and returned).
10
-
11
- Example of a ` subject ` property with a few inspection points:
12
-
13
- ``` swift
14
- var subject: some View {
15
- Text (" Hello world" )
16
- .debugLayout (" Text" )
17
- .padding (10 )
18
- .debugLayout (" padding" )
19
- .background {
20
- Color.yellow
21
- .debugLayout (" yellow" )
22
- }
23
- .debugLayout (" background" )
24
- }
25
- ```
26
-
27
- 4 . Build and run the app.
28
-
29
- - The subject view is displayed on top.
30
- - The table on the bottom displays the sizes that are being proposed at each
31
- inspection point in the subject view (" Proposal" , and the resulting view
32
- sizes (" Response" ).
33
- - You can tap/ click items in the grid to highlight the respective view.
34
- - You can use the sliders to modify the size proposed to the subject view.
35
- - Some views cache certain layout information. Press " Reset layout cache"
36
- after modifying the sliders to reset the caches.
You can’t perform that action at this time.
0 commit comments