Skip to content

Commit ec6375e

Browse files
committed
Replace demo root with component catalog
1 parent 87277a8 commit ec6375e

2 files changed

Lines changed: 49 additions & 33 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#if canImport(AndroidSwiftUI)
2+
import AndroidSwiftUI
3+
#else
4+
import SwiftUI
5+
#endif
6+
7+
/// A component catalog: one playground per supported SwiftUI feature, navigated
8+
/// with a `NavigationStack` and a lazy `List`.
9+
struct ContentView: View {
10+
11+
var body: some View {
12+
NavigationStack {
13+
List(CatalogEntry.all) { entry in
14+
NavigationLink(entry.title, destination: entry.screen)
15+
}
16+
.navigationTitle("Catalog")
17+
}
18+
}
19+
}
20+
21+
struct CatalogEntry: Identifiable {
22+
let id: String
23+
let title: String
24+
let screen: AnyCatalogScreen
25+
26+
static let all: [CatalogEntry] = [
27+
CatalogEntry(id: "text", title: "Text", screen: AnyCatalogScreen(TextPlayground())),
28+
CatalogEntry(id: "button", title: "Button", screen: AnyCatalogScreen(ButtonPlayground())),
29+
CatalogEntry(id: "toggle", title: "Toggle", screen: AnyCatalogScreen(TogglePlayground())),
30+
CatalogEntry(id: "slider", title: "Slider", screen: AnyCatalogScreen(SliderPlayground())),
31+
CatalogEntry(id: "textfield", title: "TextField", screen: AnyCatalogScreen(TextFieldPlayground())),
32+
CatalogEntry(id: "picker", title: "Picker", screen: AnyCatalogScreen(PickerPlayground())),
33+
CatalogEntry(id: "progress", title: "ProgressView", screen: AnyCatalogScreen(ProgressViewPlayground())),
34+
CatalogEntry(id: "stack", title: "Stacks", screen: AnyCatalogScreen(StackPlayground())),
35+
CatalogEntry(id: "spacer", title: "Spacer & Divider", screen: AnyCatalogScreen(SpacerDividerPlayground())),
36+
CatalogEntry(id: "color", title: "Color", screen: AnyCatalogScreen(ColorPlayground())),
37+
CatalogEntry(id: "scroll", title: "ScrollView", screen: AnyCatalogScreen(ScrollViewPlayground())),
38+
CatalogEntry(id: "list", title: "List", screen: AnyCatalogScreen(ListPlayground())),
39+
CatalogEntry(id: "grid", title: "Grid", screen: AnyCatalogScreen(GridPlayground())),
40+
CatalogEntry(id: "modifier", title: "Modifiers", screen: AnyCatalogScreen(ModifierPlayground())),
41+
CatalogEntry(id: "navigation", title: "Navigation", screen: AnyCatalogScreen(NavigationPlayground())),
42+
CatalogEntry(id: "tab", title: "TabView", screen: AnyCatalogScreen(TabViewPlayground())),
43+
CatalogEntry(id: "sheet", title: "Sheet", screen: AnyCatalogScreen(SheetPlayground())),
44+
CatalogEntry(id: "alert", title: "Alert", screen: AnyCatalogScreen(AlertPlayground())),
45+
CatalogEntry(id: "state", title: "State", screen: AnyCatalogScreen(StatePlayground())),
46+
CatalogEntry(id: "environment", title: "Environment", screen: AnyCatalogScreen(EnvironmentPlayground())),
47+
CatalogEntry(id: "observable", title: "Observable", screen: AnyCatalogScreen(ObservablePlayground())),
48+
]
49+
}

Demo/App.swiftpm/Sources/ContentView.swift

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)