- ChatTabView 신설: 앱 바 + 내부 탭(캐릭터/톡) 전환 구성 - 커스텀 탭 적용 - indicatorHeight: 4, indicatorColor: #3bb9f1 - tabText color: #b0bec5 - 폰트: 선택 전 Pretendard-Regular, 선택 후 Pretendard-Bold - HomeView/BottomTabView에 ChatTabView 연동 - CharacterView/TalkView 플레이스홀더 추가
		
			
				
	
	
		
			130 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  BottomTabView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/09.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
 | 
						|
struct BottomTabView: View {
 | 
						|
    let width: CGFloat
 | 
						|
    @Binding var currentTab: HomeViewModel.CurrentTab
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        HStack(spacing: 0) {
 | 
						|
            let tabWidth = width / 4
 | 
						|
            
 | 
						|
            TabButton(
 | 
						|
                title: "홈",
 | 
						|
                action: {
 | 
						|
                    if currentTab != .home {
 | 
						|
                        currentTab = .home
 | 
						|
                    }
 | 
						|
                },
 | 
						|
                image: {
 | 
						|
                    currentTab == .home ?
 | 
						|
                    "ic_home_selected" :
 | 
						|
                    "ic_home"
 | 
						|
                },
 | 
						|
                fontName: {
 | 
						|
                    currentTab == .home ?
 | 
						|
                    Font.bold.rawValue :
 | 
						|
                    Font.medium.rawValue
 | 
						|
                },
 | 
						|
                color: {
 | 
						|
                    currentTab == .home ?
 | 
						|
                    Color.button :
 | 
						|
                    Color.graybb
 | 
						|
                },
 | 
						|
                width: tabWidth
 | 
						|
            )
 | 
						|
            
 | 
						|
            TabButton(
 | 
						|
                title: "채팅",
 | 
						|
                action: {
 | 
						|
                    if currentTab != .chat {
 | 
						|
                        currentTab = .chat
 | 
						|
                    }
 | 
						|
                },
 | 
						|
                image: {
 | 
						|
                    currentTab == .chat ?
 | 
						|
                    "ic_chat_selected" :
 | 
						|
                    "ic_chat"
 | 
						|
                },
 | 
						|
                fontName: {
 | 
						|
                    currentTab == .chat ?
 | 
						|
                    Font.bold.rawValue :
 | 
						|
                    Font.medium.rawValue
 | 
						|
                },
 | 
						|
                color: {
 | 
						|
                    currentTab == .chat ?
 | 
						|
                    Color.button :
 | 
						|
                    Color.graybb
 | 
						|
                },
 | 
						|
                width: tabWidth
 | 
						|
            )
 | 
						|
            
 | 
						|
            TabButton(
 | 
						|
                title: "라이브",
 | 
						|
                action: {
 | 
						|
                    if currentTab != .live {
 | 
						|
                        currentTab = .live
 | 
						|
                    }
 | 
						|
                },
 | 
						|
                image: {
 | 
						|
                    currentTab == .live ?
 | 
						|
                    "ic_live_selected" :
 | 
						|
                    "ic_live"
 | 
						|
                },
 | 
						|
                fontName: {
 | 
						|
                    currentTab == .live ?
 | 
						|
                    Font.bold.rawValue :
 | 
						|
                    Font.medium.rawValue
 | 
						|
                },
 | 
						|
                color: {
 | 
						|
                    currentTab == .live ?
 | 
						|
                    Color.button :
 | 
						|
                    Color.graybb
 | 
						|
                },
 | 
						|
                width: tabWidth
 | 
						|
            )
 | 
						|
            
 | 
						|
            TabButton(
 | 
						|
                title: "마이",
 | 
						|
                action: {
 | 
						|
                    if currentTab != .mypage {
 | 
						|
                        currentTab = .mypage
 | 
						|
                    }
 | 
						|
                },
 | 
						|
                image: {
 | 
						|
                    currentTab == .mypage ?
 | 
						|
                    "ic_my_selected" :
 | 
						|
                    "ic_my"
 | 
						|
                },
 | 
						|
                fontName: {
 | 
						|
                    currentTab == .mypage ?
 | 
						|
                    Font.bold.rawValue :
 | 
						|
                    Font.medium.rawValue
 | 
						|
                },
 | 
						|
                color: {
 | 
						|
                    currentTab == .mypage ?
 | 
						|
                    Color.button :
 | 
						|
                    Color.graybb
 | 
						|
                },
 | 
						|
                width: tabWidth
 | 
						|
            )
 | 
						|
        }
 | 
						|
        .background(Color.gray11)
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct BottomTabView_Previews: PreviewProvider {
 | 
						|
    static var previews: some View {
 | 
						|
        BottomTabView(
 | 
						|
            width: UIScreen.main.bounds.width,
 | 
						|
            currentTab: .constant(.live)
 | 
						|
        )
 | 
						|
    }
 | 
						|
}
 |