DayByDay/Parent/GatedView.swift
22 lines · 453 bytes
1 symbol in this file
1//
2// GatedView.swift
3// DayByDay
4//
5
6import SwiftUI
7
8/// Shows the parent gate first, then `content` once it is passed.
9struct GatedView<Content: View>: View {
10 let onCancel: () -> Void
11 @ViewBuilder let content: () -> Content
12
13 @State private var passed = false
14
15 var body: some View {
16 if passed {
17 content()
18 } else {
19 ParentGateView(onPass: { passed = true }, onCancel: onCancel)
20 }
21 }
22}