-
Notifications
You must be signed in to change notification settings - Fork 0
/
MiroView.swift
82 lines (67 loc) · 1.96 KB
/
MiroView.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
//
// MiroView.swift
// Colli-Flower
//
// Created by 최명근 on 2023/03/27.
//
import Foundation
import SwiftUI
struct MiroView<Content>: View where Content: View {
@State var title: String = ""
@State var message: String = ""
@ViewBuilder var content: () -> Content
@Environment(\.dismiss) private var dismiss
var body: some View {
VStack(spacing: 0) {
// MARK: - Title
HStack {
// Back Button
Button {
dismiss()
} label: {
Image(systemName: "chevron.backward")
}
.foregroundColor(Color.white)
Spacer()
// Title
Text(title)
.font(.system(size: 28))
.foregroundColor(Color.white)
Spacer()
}
.padding(8)
.background(
Color.green.ignoresSafeArea(.all)
)
// MARK: - Message (or instructions)
if !message.isEmpty {
HStack {
HStack {
Text(message)
.font(.system(size: 24))
.padding(16)
Spacer()
}
}
.border(Color.green, width: 2)
}
Spacer()
// MARK: - Content
VStack {
content()
}
Spacer()
}
.border(Color.green, width: 2)
.navigationBarBackButtonHidden(true)
}
}
struct MiroView_Previews: PreviewProvider {
static var previews: some View {
MiroView {
Text("Hello, world!")
}
.previewInterfaceOrientation(.landscapeLeft)
.previewDevice("iPad Pro (12.9-inch) (6th generation)")
}
}