Skip to content

Commit 82dd39c

Browse files
committed
ui: 새창 / 풀스크린 버전 ui 분리
1 parent 31167bc commit 82dd39c

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

Application/DevLogPresentation/Sources/Home/TodoEditorView.swift

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct TodoEditorView: View {
1515
@State var viewModel: TodoEditorViewModel
1616
@Environment(\.diContainer) private var container: DIContainer
1717
@Environment(\.dismiss) private var dismiss
18+
@Environment(\.isiOSAppOnMac) private var isiOSAppOnMac
1819
@FocusState private var field: Field?
1920
private let calendar = Calendar.current
2021
var onSubmit: ((Todo) -> Void)?
@@ -24,7 +25,7 @@ struct TodoEditorView: View {
2425
NavigationStack {
2526
ScrollView {
2627
LazyVStack(spacing: 10) {
27-
titleField
28+
titleSection
2829
LazyVStack(
2930
alignment: .leading,
3031
spacing: 0,
@@ -33,7 +34,10 @@ struct TodoEditorView: View {
3334
Section {
3435
tabView
3536
} header: {
36-
tabViewSelector
37+
if !isiOSAppOnMac {
38+
tabPicker
39+
.padding(.horizontal)
40+
}
3741
}
3842
}
3943
}
@@ -75,7 +79,9 @@ struct TodoEditorView: View {
7579
.presentationDragIndicator(.visible)
7680
}
7781
.toolbar {
78-
ToolbarLeadingButton { close() }
82+
if !isiOSAppOnMac {
83+
ToolbarLeadingButton { close() }
84+
}
7985
ToolbarItem(placement: .topBarTrailing) {
8086
Button {
8187
viewModel.send(.setShowInfo(true))
@@ -91,6 +97,22 @@ struct TodoEditorView: View {
9197
}
9298
}
9399

100+
@ViewBuilder
101+
private var titleSection: some View {
102+
Group {
103+
if isiOSAppOnMac {
104+
HStack(spacing: 12) {
105+
titleField
106+
tabPicker
107+
.frame(width: 180)
108+
}
109+
} else {
110+
titleField
111+
}
112+
}
113+
.padding(.horizontal)
114+
}
115+
94116
private var titleField: some View {
95117
TextField(
96118
"",
@@ -103,10 +125,9 @@ struct TodoEditorView: View {
103125
.font(.title2)
104126
.frame(height: 30)
105127
.focused($field, equals: .title)
106-
.padding(.horizontal)
107128
}
108129

109-
private var tabViewSelector: some View {
130+
private var tabPicker: some View {
110131
Picker(
111132
"",
112133
selection: Binding(
@@ -127,7 +148,6 @@ struct TodoEditorView: View {
127148
.tag(TodoEditorViewModel.Tag.preview)
128149
}
129150
.pickerStyle(.segmented)
130-
.padding(.horizontal)
131151
}
132152

133153
private var tabView: some View {

0 commit comments

Comments
 (0)