Skip to content

Commit e02bb2d

Browse files
committed
Feat: TabBarView 구현
1 parent b0d47ee commit e02bb2d

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
//
2+
// TabBarView.swift
3+
// Presentation
4+
//
5+
// Created by 최정인 on 7/16/25.
6+
//
7+
8+
import Shared
9+
import UIKit
10+
11+
final public class TabBarView: UITabBarController {
12+
13+
override public func viewDidLoad() {
14+
super.viewDidLoad()
15+
configureAttribute()
16+
}
17+
18+
private func configureAttribute() {
19+
let appearance = UITabBarAppearance()
20+
appearance.configureWithDefaultBackground()
21+
appearance.backgroundColor = .systemBackground
22+
23+
let normalAttributes: [NSAttributedString.Key: Any] = [
24+
.foregroundColor: BitnagilColor.navy100 ?? .systemGray,
25+
.font: BitnagilFont(style: .caption2, weight: .medium).font
26+
]
27+
appearance.stackedLayoutAppearance.normal.titleTextAttributes = normalAttributes
28+
appearance.stackedLayoutAppearance.normal.iconColor = BitnagilColor.navy100
29+
30+
let selectedAttributes: [NSAttributedString.Key: Any] = [
31+
.foregroundColor: BitnagilColor.navy600 ?? .systemGray,
32+
.font: BitnagilFont(style: .caption2, weight: .medium).font
33+
]
34+
appearance.stackedLayoutAppearance.selected.titleTextAttributes = selectedAttributes
35+
appearance.stackedLayoutAppearance.selected.iconColor = BitnagilColor.navy600
36+
37+
tabBar.standardAppearance = appearance
38+
tabBar.tintColor = BitnagilColor.navy600
39+
tabBar.unselectedItemTintColor = BitnagilColor.navy100
40+
41+
let homeView = HomeView()
42+
let recommendView = RecommendView()
43+
let reportView = ReportView()
44+
let mypageView = MypageView()
45+
46+
homeView.tabBarItem = UITabBarItem(
47+
title: "",
48+
image: BitnagilIcon.homeEmptyIcon,
49+
selectedImage: BitnagilIcon.homeFillIcon)
50+
51+
recommendView.tabBarItem = UITabBarItem(
52+
title: "추천루틴",
53+
image: BitnagilIcon.recommendEmptyIcon,
54+
selectedImage: BitnagilIcon.recommendFillIcon)
55+
56+
reportView.tabBarItem = UITabBarItem(
57+
title: "리포트",
58+
image: BitnagilIcon.reportEmptyIcon,
59+
selectedImage: BitnagilIcon.reportFillIcon)
60+
61+
mypageView.tabBarItem = UITabBarItem(
62+
title: "마이페이지",
63+
image: BitnagilIcon.mypageEmptyIcon,
64+
selectedImage: BitnagilIcon.mypageFillIcon)
65+
66+
viewControllers = [
67+
UINavigationController(rootViewController: homeView),
68+
UINavigationController(rootViewController: recommendView),
69+
UINavigationController(rootViewController: reportView),
70+
UINavigationController(rootViewController: mypageView)
71+
]
72+
}
73+
}
74+
75+
// TODO: - 홈, 추천, 마이페이지 생성 후 지워주세요
76+
final class HomeView: UIViewController {
77+
override func viewDidLoad() {
78+
super.viewDidLoad()
79+
view.backgroundColor = .white
80+
}
81+
}
82+
83+
final class RecommendView: UIViewController {
84+
override func viewDidLoad() {
85+
super.viewDidLoad()
86+
view.backgroundColor = .white
87+
}
88+
}
89+
90+
final class ReportView: UIViewController {
91+
override func viewDidLoad() {
92+
super.viewDidLoad()
93+
view.backgroundColor = .white
94+
}
95+
}
96+
97+
final class MypageView: UIViewController {
98+
override func viewDidLoad() {
99+
super.viewDidLoad()
100+
view.backgroundColor = .white
101+
}
102+
}

0 commit comments

Comments
 (0)