From 8b7f3fbd07f32c6a8be29b785cddf6a573d037ed Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 21 Aug 2023 04:20:13 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=B8=EC=9D=B8=EC=9D=B8=EC=A6=9D=EC=9D=84?= =?UTF-8?q?=20=ED=95=9C=20=EC=9C=A0=EC=A0=80=EB=A7=8C=20=EB=A9=94=EC=8B=9C?= =?UTF-8?q?=EC=A7=80=20=ED=83=AD=EC=9D=B4=20=EB=B3=B4=EC=9D=B4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Main/Home/BottomTabView.swift | 64 +++++++++++-------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/SodaLive/Sources/Main/Home/BottomTabView.swift b/SodaLive/Sources/Main/Home/BottomTabView.swift index 9d1031d..c11e073 100644 --- a/SodaLive/Sources/Main/Home/BottomTabView.swift +++ b/SodaLive/Sources/Main/Home/BottomTabView.swift @@ -9,12 +9,22 @@ import SwiftUI struct BottomTabView: View { let width: CGFloat + let tabWidth: CGFloat @Binding var currentTab: HomeViewModel.CurrentTab + init(width: CGFloat, currentTab: Binding) { + self.width = width + self._currentTab = currentTab + + if UserDefaults.bool(forKey: .auth) { + tabWidth = width / 5 + } else { + tabWidth = width / 4 + } + } + var body: some View { HStack(spacing: 0) { - let tabWidth = width / 5 - TabButton( title: "콘텐츠", action: { @@ -90,30 +100,32 @@ struct BottomTabView: View { width: tabWidth ) - TabButton( - title: "메시지", - action: { - if currentTab != .message { - currentTab = .message - } - }, - image: { - currentTab == .message ? - "ic_tabbar_message_selected" : - "ic_tabbar_message_normal" - }, - fontName: { - currentTab == .message ? - Font.bold.rawValue : - Font.medium.rawValue - }, - color: { - currentTab == .message ? - Color(hex: "9970ff") : - Color(hex: "909090") - }, - width: tabWidth - ) + if UserDefaults.bool(forKey: .auth) { + TabButton( + title: "메시지", + action: { + if currentTab != .message { + currentTab = .message + } + }, + image: { + currentTab == .message ? + "ic_tabbar_message_selected" : + "ic_tabbar_message_normal" + }, + fontName: { + currentTab == .message ? + Font.bold.rawValue : + Font.medium.rawValue + }, + color: { + currentTab == .message ? + Color(hex: "9970ff") : + Color(hex: "909090") + }, + width: tabWidth + ) + } TabButton( title: "마이",