From 84dae451e852e14d4eedc4e03228b1aa0e9d937f Mon Sep 17 00:00:00 2001 From: hooni <jhlee909090@gmail.com> Date: Thu, 16 Jan 2025 02:12:21 +0900 Subject: [PATCH 1/4] =?UTF-8?q?style:=20#54=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20UI=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/Feature/Search/SearchView.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift diff --git a/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift b/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift new file mode 100644 index 00000000..11b5de1d --- /dev/null +++ b/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift @@ -0,0 +1,33 @@ +// +// SearchView.swift +// Spoony-iOS +// +// Created by 이지훈 on 1/16/25. +// + +import SwiftUI + +struct SearchView: View { + @EnvironmentObject private var navigationManager: NavigationManager + @State private var searchText = "" + + var body: some View { + VStack(spacing: 0) { + CustomNavigationBar( + style: .search(showBackButton: true), + searchText: $searchText, + onBackTapped: { + // 뒤로가기 + navigationManager.pop(1) + }, + onSearchSubmit: nil + ) + + Spacer() + } + } +} + +#Preview { + SearchView() +} From 1e2336cd282c9061a0c8d686f9e5811da6ac95e5 Mon Sep 17 00:00:00 2001 From: hooni <jhlee909090@gmail.com> Date: Thu, 16 Jan 2025 02:27:54 +0900 Subject: [PATCH 2/4] =?UTF-8?q?style/#54=20=EB=84=A4=EB=B9=84=EA=B2=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=95=A0=EB=8B=88=EB=A9=94=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Navigation/CustomNavigationBar.swift | 90 +++++++++---------- .../Resource/Tab/NavigationManager.swift | 2 +- .../Spoony-iOS/Source/ContentView.swift | 4 +- .../Spoony-iOS/Source/Feature/Home/Home.swift | 10 ++- 4 files changed, 56 insertions(+), 50 deletions(-) diff --git a/Spoony-iOS/Spoony-iOS/Resource/Components/Navigation/CustomNavigationBar.swift b/Spoony-iOS/Spoony-iOS/Resource/Components/Navigation/CustomNavigationBar.swift index 728c36df..87f5556d 100644 --- a/Spoony-iOS/Spoony-iOS/Resource/Components/Navigation/CustomNavigationBar.swift +++ b/Spoony-iOS/Spoony-iOS/Resource/Components/Navigation/CustomNavigationBar.swift @@ -33,29 +33,29 @@ struct CustomNavigationBar: View { } var body: some View { - ZStack { - if style.showsBackButton { - backButton - } - - switch style { - case .primary: - primaryContent - case .search: - searchContent - case .locationDetail: - locationDetailContent - case .locationTitle: - locationTitleContent - case .detail(let isLiked): - detailContent(isLiked: isLiked) - case .detailWithChip(let count): - detailWithChipContent(count: count) - } - } - .frame(height: 56.adjusted) - .background(.white) - } + ZStack { + if style.showsBackButton { + backButton + } + + switch style { + case .primary: + primaryContent + case .search: + searchContent + case .locationDetail: + locationDetailContent + case .locationTitle: + locationTitleContent + case .detail(let isLiked): + detailContent(isLiked: isLiked) + case .detailWithChip(let count): + detailWithChipContent(count: count) + } + } + .frame(height: 56.adjusted) + .background(.clear) + } private var backButtonView: some View { Button(action: onBackTapped) { @@ -70,7 +70,7 @@ struct CustomNavigationBar: View { } .padding(.horizontal, 16) } - + private var primaryContent: some View { HStack { if !title.isEmpty { @@ -80,37 +80,31 @@ struct CustomNavigationBar: View { Spacer() } } - + private var searchContent: some View { HStack(spacing: 12) { - if style.showsBackButton { - backButtonView - } + LogoChip(type: .small, count: 10) HStack(spacing: 8) { Image(.icSearchGray600) - TextField("", text: $searchText) - .frame(height: 44.adjusted) - .placeholder(when: searchText.isEmpty) { - Text("플레이스 홀더") - .foregroundColor(Color(.gray600)) - } - - if !searchText.isEmpty { - Button(action: { searchText = "" }) { - Image(.icCloseGray400) - .foregroundColor(Color(.gray600)) - } - } + Text("오늘은 어디서 먹어볼까요?") + .foregroundColor(Color(.gray500)) + .frame(maxWidth: .infinity, alignment: .leading) } .padding(.horizontal, 12) - .background(Color.white) - .overlay( - RoundedRectangle(cornerRadius: 8) - .stroke(Color(.gray600), lineWidth: 1) + .frame(height: 44.adjustedH) + .background( + RoundedRectangle(cornerRadius: 10) + .fill(Color.white) + .overlay( + RoundedRectangle(cornerRadius: 10) + .stroke(Color(.gray200), lineWidth: 1) + ) ) - .frame(height: 44.adjusted) + .onTapGesture { + onSearchSubmit?() + } } .padding(.horizontal, 16) } @@ -181,3 +175,7 @@ struct CustomNavigationBar: View { .padding(.horizontal, 16) } } + +#Preview { + Home() +} diff --git a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift index 1c6097ca..d7a359ee 100644 --- a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift +++ b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift @@ -22,7 +22,7 @@ final class NavigationManager: ObservableObject { Explore() case .searchView: - Home() + SearchView() case .locationView: Home() diff --git a/Spoony-iOS/Spoony-iOS/Source/ContentView.swift b/Spoony-iOS/Spoony-iOS/Source/ContentView.swift index 9680a333..4b2bb256 100644 --- a/Spoony-iOS/Spoony-iOS/Source/ContentView.swift +++ b/Spoony-iOS/Spoony-iOS/Source/ContentView.swift @@ -15,8 +15,10 @@ struct ContentView: View { TabView(selection: $navigationManager.selectedTab) { NavigationStack(path: $navigationManager.mapPath) { Home() + .navigationDestination(for: ViewType.self) { viewType in + navigationManager.build(viewType) + } } - } .environmentObject(navigationManager) } diff --git a/Spoony-iOS/Spoony-iOS/Source/Feature/Home/Home.swift b/Spoony-iOS/Spoony-iOS/Source/Feature/Home/Home.swift index da8bc09b..be21c9d0 100644 --- a/Spoony-iOS/Spoony-iOS/Source/Feature/Home/Home.swift +++ b/Spoony-iOS/Spoony-iOS/Source/Feature/Home/Home.swift @@ -21,10 +21,11 @@ struct Home: View { style: .search(showBackButton: false), searchText: $searchText, onBackTapped: {}, - onSearchSubmit: nil, + onSearchSubmit: { + navigationManager.push(.searchView) + }, onLikeTapped: nil ) - .padding(.top, 44) Spacer() } @@ -34,3 +35,8 @@ struct Home: View { } } } + +#Preview { + Home() + .environmentObject(NavigationManager()) +} From 12cd24d0fa012d93448e8ec9064ea9439adb6810 Mon Sep 17 00:00:00 2001 From: hooni <jhlee909090@gmail.com> Date: Thu, 16 Jan 2025 05:49:16 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20#54=20=EC=BD=94=EB=A6=AC=EB=B0=98?= =?UTF-8?q?=EC=98=81=20=ED=95=98=EB=8B=A8=ED=83=AD=EB=B0=94=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resource/Tab/NavigationManager.swift | 15 +++++++++++---- .../Source/Feature/Search/SearchView.swift | 8 +------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift index d7a359ee..de446366 100644 --- a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift +++ b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift @@ -10,6 +10,7 @@ import SwiftUI final class NavigationManager: ObservableObject { @Published var selectedTab: TabType = .map + @Published var isTabBarVisible: Bool = true @Published var mapPath: [ViewType] = [] @Published var explorePath: [ViewType] = [] @@ -20,21 +21,24 @@ final class NavigationManager: ObservableObject { switch view { case .test: Explore() - + case .searchView: SearchView() case .locationView: Home() - + case .detailView: Home() - + } } func push(_ view: ViewType) { switch selectedTab { case .map: + if view == .searchView { + isTabBarVisible = false + } mapPath.append(view) case .explore: explorePath.append(view) @@ -42,11 +46,14 @@ final class NavigationManager: ObservableObject { registerPath.append(view) } } - + func pop(_ depth: Int) { switch selectedTab { case .map: mapPath.removeLast(depth) + if mapPath.isEmpty || !mapPath.contains(.searchView) { + isTabBarVisible = true + } case .explore: explorePath.removeLast(depth) case .register: diff --git a/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift b/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift index 11b5de1d..f8077378 100644 --- a/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift +++ b/Spoony-iOS/Spoony-iOS/Source/Feature/Search/SearchView.swift @@ -17,17 +17,11 @@ struct SearchView: View { style: .search(showBackButton: true), searchText: $searchText, onBackTapped: { - // 뒤로가기 navigationManager.pop(1) }, onSearchSubmit: nil ) - - Spacer() } + .toolbar(.hidden, for: .tabBar) } } - -#Preview { - SearchView() -} From 48cd1cadb69ea70952f88b4aae60a60365580fa0 Mon Sep 17 00:00:00 2001 From: hooni <jhlee909090@gmail.com> Date: Thu, 16 Jan 2025 09:19:20 +0900 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20#54=20=ED=83=AD=EB=B0=94=20=EC=A4=91?= =?UTF-8?q?=EB=B3=B5=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .toolbar(.hidden, for: .tabBar) 으로 제어 --- .../Spoony-iOS/Resource/Tab/NavigationManager.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift index de446366..bc13b196 100644 --- a/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift +++ b/Spoony-iOS/Spoony-iOS/Resource/Tab/NavigationManager.swift @@ -10,8 +10,6 @@ import SwiftUI final class NavigationManager: ObservableObject { @Published var selectedTab: TabType = .map - @Published var isTabBarVisible: Bool = true - @Published var mapPath: [ViewType] = [] @Published var explorePath: [ViewType] = [] @Published var registerPath: [ViewType] = [] @@ -36,9 +34,6 @@ final class NavigationManager: ObservableObject { func push(_ view: ViewType) { switch selectedTab { case .map: - if view == .searchView { - isTabBarVisible = false - } mapPath.append(view) case .explore: explorePath.append(view) @@ -51,9 +46,6 @@ final class NavigationManager: ObservableObject { switch selectedTab { case .map: mapPath.removeLast(depth) - if mapPath.isEmpty || !mapPath.contains(.searchView) { - isTabBarVisible = true - } case .explore: explorePath.removeLast(depth) case .register: