From 16bc92d199e05ae18f9b666f29310aae97bb2739 Mon Sep 17 00:00:00 2001 From: Park Seo Yeon Date: Tue, 18 Jun 2024 02:51:29 +0900 Subject: [PATCH] =?UTF-8?q?:lipstick:=20[Design]=20Tabbar=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B8=201=EC=B0=A8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tabbar/Sample/AnotherView.swift | 19 -------- .../Tabbar/Sample/SampleView.swift | 3 -- .../Tabbar/TabbarMainView.swift | 23 +-------- .../Tabbar+Navigation/Tabbar/TabbarView.swift | 48 ++++++++++++------- 4 files changed, 32 insertions(+), 61 deletions(-) delete mode 100644 Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/AnotherView.swift diff --git a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/AnotherView.swift b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/AnotherView.swift deleted file mode 100644 index 4db7482..0000000 --- a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/AnotherView.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// AnotherView.swift -// App -// -// Created by 박서연 on 2024/06/13. -// Copyright © 2024 iOS. All rights reserved. -// - -import SwiftUI - -struct AnotherView: View { - var body: some View { - Text("Saaaaample Viewwwwww") - } -} - -#Preview { - AnotherView() -} diff --git a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/SampleView.swift b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/SampleView.swift index 95cd6d1..114180a 100644 --- a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/SampleView.swift +++ b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/Sample/SampleView.swift @@ -13,10 +13,7 @@ struct HomeView: View { var body: some View { ZStack { -// Color.red -// .ignoresSafeArea() Text("GO TO ANOTHERVIEW") -// .foregroundStyle(.white) .font(.largeTitle) .onTapGesture { router.navigateTo(.categoryFilter) diff --git a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarMainView.swift b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarMainView.swift index cbdd51c..f86bb4f 100644 --- a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarMainView.swift +++ b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarMainView.swift @@ -10,7 +10,7 @@ import SwiftUI struct TabbarMainView: View { @StateObject public var viewModel = TabbarViewModel() - + var body: some View { TabView(selection: $viewModel.selected) { ForEach(Tabbar.allCases, id: \.self) { tab in @@ -21,26 +21,7 @@ struct TabbarMainView: View { .overlay { VStack { Spacer() - HStack { - ForEach(Tabbar.allCases, id: \.self) { item in - VStack(spacing: 5) { - Image(systemName: item.image) - .frame(width: 24, height: 24) - Text(item.title) - .applyFont(font: .label1) - .foregroundStyle(Color.neutral400) - } - .frame(maxWidth: .infinity, alignment: .center) - .contentShape(Rectangle()) - .padding(.bottom, 10) - .onTapGesture { - viewModel.selected = item - print("item \(item)") - } - } - } - .padding(.top, 10) - .background(.white) + TabbarView(viewModel: viewModel) } } } diff --git a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarView.swift b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarView.swift index c0fd702..2b3f2c5 100644 --- a/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarView.swift +++ b/Projects/App/Sources/Presentation/Tabbar+Navigation/Tabbar/TabbarView.swift @@ -10,28 +10,40 @@ import SwiftUI struct TabbarView: View { @ObservedObject var viewModel: TabbarViewModel + @EnvironmentObject var router: Router var body: some View { - HStack { - ForEach(Tabbar.allCases, id: \.self) { item in - VStack(spacing: 5) { - Image(systemName: item.image) - .frame(width: 24, height: 24) - Text(item.title) - .applyFont(font: .label1) - .foregroundStyle(Color.neutral400) - } - .frame(maxWidth: .infinity, alignment: .center) - .contentShape(Rectangle()) - .padding(.bottom, 10) - .onTapGesture { - viewModel.selected = item - print("item \(item)") + Rectangle() + .fill(Color.white) + .shadow(color: .black.opacity(0.01), radius: 1, y: -2.0) + .blur(radius: 8) + .shadow(radius: 10) + .frame(height: 66) + .overlay { + HStack { + ForEach(Tabbar.allCases, id: \.self) { item in + VStack(spacing: 5) { + Image(systemName: item.image) + .frame(width: 24, height: 24) + Text(item.title) + .applyFont(font: .label1) + .foregroundStyle(Color.neutral400) + } + .frame(maxWidth: .infinity, alignment: .center) + .contentShape(Rectangle()) + .padding(.bottom, 10) + .onTapGesture { + viewModel.selected = item + } +// .simultaneousGesture(TapGesture(count: 2).onEnded { +// router.popToRoot() +// }) + } } + .padding(.top, 10) + .background(.white) } - } - .padding(.top, 10) - .background(.white) + } }