@@ -6,18 +6,61 @@ struct ContentView: View {
6
6
@State private var selectedView : String ? = nil
7
7
@State private var generation : Int = 0
8
8
9
+ // MARK: - Edit here
10
+
11
+ /// The view tree whose layout you want to inspect. Add `.debugLayout()` calls at
12
+ /// each point where you want to inspect the layout algorithm, i.e. what sizes are
13
+ /// being proposed and returned. We call these **inspection points**.
14
+ ///
15
+ /// ## Suggested examples
16
+ ///
17
+ /// ### Padding
18
+ ///
19
+ /// var subject: some View {
20
+ /// Text("Hello world")
21
+ /// .debugLayout("Text")
22
+ /// .padding(10)
23
+ /// .debugLayout("padding")
24
+ /// .border(Color.green)
25
+ /// .debugLayout("border")
26
+ /// }
27
+ ///
28
+ /// ### Stacks
29
+ ///
30
+ /// var subject: some View {
31
+ /// HStack(spacing: 10) {
32
+ /// Rectangle().fill(.green)
33
+ /// .debugLayout("green")
34
+ /// Text("Hello world")
35
+ /// .debugLayout("Text")
36
+ /// Rectangle().fill(.yellow)
37
+ /// .debugLayout("yellow")
38
+ /// }
39
+ /// .debugLayout("HStack")
40
+ /// }
41
+ ///
42
+ /// ### fixedSize
43
+ ///
44
+ /// var subject: some View {
45
+ /// Text("Lorem ipsum dolor sit amet")
46
+ /// .debugLayout("Text")
47
+ /// .fixedSize()
48
+ /// .debugLayout("fixedSize")
49
+ /// .frame(width: 100)
50
+ /// .debugLayout("frame")
51
+ /// .border(Color.green)
52
+ /// }
9
53
var subject : some View {
10
54
Text ( " Hello world " )
11
55
. debugLayout ( " Text " )
12
- . padding ( )
56
+ . padding ( 10 )
13
57
. debugLayout ( " padding " )
14
- . background {
15
- Color . yellow
16
- . debugLayout ( " yellow " )
17
- }
18
- . debugLayout ( " background " )
58
+ . border ( Color . green)
59
+ . debugLayout ( " border " )
19
60
}
20
61
62
+ // MARK: Edit end
63
+
21
64
var body : some View {
22
65
VStack {
23
66
VStack {
0 commit comments