-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path03-31-2021.swift
61 lines (55 loc) · 2.74 KB
/
03-31-2021.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
import SwiftUI
/**
Build a view that allows for multiple subviews of the same kind and vertical dividers only between elements.
- The first element shouldn't have a leading dividers.
- The last element shouldn't have a trailing dividers.
- If you only have one element it shouldn't have any dividers.
```
┌────┐ ┌───────────────┐ │ ┌────┐ ┌───────────────┐ │ ┌────┐ ┌───────────────┐
│icon│ │Title │ │ │icon│ │Title │ │ │icon│ │Title │
└────┘ └───────────────┘ │ └────┘ └───────────────┘ │ └────┘ └───────────────┘
┌──────────────────────┐ │ ┌──────────────────────┐ │ ┌──────────────────────┐
│Subtitle │ │ │Subtitle │ │ │Subtitle │
└──────────────────────┘ │ └──────────────────────┘ │ └──────────────────────┘
*/
struct ContentView: View {
var body: some View {
HStack {
StatusItem(title: "Dali", subtitle: "is the boss", symbolName: "calendar.circle.fill")
StatusItem(title: "G", subtitle: "is the wizard", symbolName: "calendar.circle.fill")
StatusItem(title: "Jimmy", subtitle: "is the jefe", symbolName: "speaker.wave.2.circle.fill")
}
.frame(width: .infinity)
}
}
struct StatusItem: View {
let title: String
let subtitle: String
let symbolName: String
var body: some View {
HStack {
Spacer()
VStack(alignment: .leading, spacing: 4) {
HStack(spacing: 8) {
Image(systemName: symbolName)
.font(.title2)
Text(title)
.font(.title2)
.bold()
}
Text(subtitle)
.font(.body)
}
Spacer()
Divider()
}
.fixedSize(horizontal: false, vertical: true)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.previewDevice("iPad Pro (9.7-inch)")
// .environment(\.sizeCategory, .accessibilityLarge)
}
}