-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathCaseStudies.swift
89 lines (85 loc) · 2.42 KB
/
CaseStudies.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import SwiftUI
struct Category: Identifiable {
var id: String
var label: LocalizedStringKey
var elements: [CaseStudy]
}
struct CaseStudy: Identifiable, Equatable {
var id: ID
var label: LocalizedStringKey
var description: LocalizedStringKey?
enum ID: CaseIterable {
case id
case ifElse
case lazyVGrid
case lazyVStack
case listDynamic
case listStatic
case navigationStack
case opacity
case scrollViewDynamic
case scrollViewStatic
case `switch`
case tabView
}
}
let categories: [Category] = [
Category(
id: "simple",
label: "Simple views",
elements: [
CaseStudy(id: .ifElse, label: "if/else"),
CaseStudy(id: .switch, label: "switch"),
CaseStudy(id: .id, label: ".id(_:)"),
CaseStudy(id: .opacity, label: ".opacity(_:)")
]
),
Category(
id: "scrollview",
label: "ScrollView",
elements: [
CaseStudy(id: .scrollViewStatic, label: "ScrollView with static content"),
CaseStudy(
id: .scrollViewDynamic,
label: "ScrollView with dynamic content",
description: "A VStack with dynamic content, embedded in a ScrollView."
),
]
),
Category(
id: "list",
label: "List",
elements: [
CaseStudy(id: .listDynamic, label: "List with dynamic content"),
CaseStudy(
id: .listStatic,
label: "List with static content",
description: "A List with a bunch of hardcoded child views, not using ForEach."
),
]
),
Category(
id: "lazy",
label: "Lazy containers",
elements: [
CaseStudy(id: .lazyVStack, label: "LazyVStack"),
CaseStudy(id: .lazyVGrid, label: "LazyVGrid"),
]
),
Category(
id: "navigation",
label: "Navigation containers",
elements: [
CaseStudy(
id: .navigationStack,
label: "NavigationStack",
description: "A NavigationStack with infinite levels of drill-down."
),
CaseStudy(
id: .tabView,
label: "TabView",
description: "TabView with multiple tabs, each with static content."
),
]
),
]