gh-EmergeTools-Pow/Example/Pow Example/PowExampleApp.swift
Joe Fabisevich 781d455727
Moving Pow to @emergetools
Co-authored-by: Robert Böhnke <robb@robb.is>
Co-authored-by: Kasper Lahti <kasper@lahti.email>
2023-11-29 09:38:34 -05:00

40 lines
1.1 KiB
Swift

import SwiftUI
@main
struct PowExampleApp: App {
struct Presentation: Identifiable {
var type: any Example.Type
var id: UUID = UUID()
}
@State
var presentedType: Presentation? = nil
var body: some Scene {
WindowGroup {
NavigationStack {
ExampleList()
}
.environment(\.presentInfoAction, PresentInfoAction {
presentedType = Presentation(type: $0)
})
.sheet(item: $presentedType) { t in
ScrollView {
VStack(alignment: .leading, spacing: 12) {
Text(t.type.title).font(.title.bold())
GithubButton(t.type.localPath)
.controlSize(.small)
.buttonStyle(.bordered)
t.type.erasedDescription
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
}
.presentationDetents([.medium])
}
}
}
}