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: "마이",