-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStacks.swift
72 lines (56 loc) · 2.05 KB
/
Stacks.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import SwiftUI
struct Stacks: View {
var body: some View {
VStack(alignment: .trailing, spacing: 0, content: {
RoundedRectangle(cornerRadius: 10)
.fill(.red)
.frame(width: 150, height: 150)
RoundedRectangle(cornerRadius: 10)
.fill(.green)
.frame(width: 100, height: 100)
RoundedRectangle(cornerRadius: 10)
.fill(.orange)
.frame(width: 50, height: 50)
Text("VStack")
})
.padding()
.border(.black)
HStack {
Text("HStack")
RoundedRectangle(cornerRadius: 10)
.fill(.red)
.frame(width: 100, height: 100)
RoundedRectangle(cornerRadius: 10)
.fill(.green)
.frame(width: 100, height: 100)
RoundedRectangle(cornerRadius: 10)
.fill(.orange)
.frame(width: 100, height: 100)
}
.padding()
.border(.black)
ZStack(alignment: .topTrailing) {
RoundedRectangle(cornerRadius: 10)
.fill(.yellow)
.frame(width: 350, height: 350)
VStack(alignment: .leading, spacing: 30) {
RoundedRectangle(cornerRadius: 10) .fill(.red)
.frame(width: 100, height: 100)
RoundedRectangle(cornerRadius: 10) .fill(.green)
.frame(width: 90, height: 90)
HStack(alignment: .bottom) {
RoundedRectangle(cornerRadius: 10) .fill(.pink)
.frame(width: 75, height: 75)
RoundedRectangle(cornerRadius: 10) .fill(.purple)
.frame(width: 50, height: 50)
RoundedRectangle(cornerRadius: 10) .fill(.blue)
.frame(width: 25, height: 25)
}
}
Text("ZStack")
}
}
}
#Preview {
Stacks()
}