portico/Sources/Example/ExampleApp.swift

40 lines
926 B
Swift

import Portico
struct Counter: View {
@State private var count = 0
var body: some View {
VStack(spacing: 12) {
Label { "Count: \(count)" }
HStack(spacing: 12) {
Button("-") { count -= 1 }
Button("+") { count += 1 }
}
}
}
}
struct ToggleDemo: View {
@State private var show = true
var body: some View {
VStack(spacing: 12) {
Button("Toggle") { show.toggle() }
EitherView($show,
first: { Label("First branch — visible") },
second: { Label("Second branch — hidden") }
)
}
}
}
@main
struct ExampleApp: App {
var applicationId: String? { "dev.bscubed.PorticoExample" }
var body: some Scene {
Window { _ in ToggleDemo() }
.title("Portico P2")
.defaultSize(width: 1280, height: 800)
}
}