Skip to content

Commit a5eff16

Browse files
authored
[Feat-T3-132] 설정 화면 구현
* feat: 이미지 asset 추가 * feat: TableViewCell 구현 - TableView에서 사용할 수 있는 3가지 타입의 cell 구현 - chevron 이미지로 다음 화면으로 넘어갈 수 있는 cell - button이 있는 cell - switch가 있는 cell * feat: 커스텀 Alert View 추가 * feat: 설정 화면 커스텀 tableView Section HeaderView 구현 * feat: 설정 화면 구현 * feat: navigationController appearance 수정 * refactor: custom alert 파라미터 이름 수정, alert 표시 타입 수정 * refactor: 오타 수정 (토끼 리뷰 반영)
1 parent 5587dc2 commit a5eff16

16 files changed

Lines changed: 969 additions & 27 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "exclamation_filled_icon@1x.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "exclamation_filled_icon@2x.png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "exclamation_filled_icon@3x.png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
1.31 KB
Loading
2.43 KB
Loading
3.56 KB
Loading
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// MyPageTableViewCell.swift
3+
// Presentation
4+
//
5+
// Created by 이동현 on 7/17/25.
6+
//
7+
8+
import SnapKit
9+
import UIKit
10+
11+
class BitnagilBaseTableViewCell: UITableViewCell {
12+
private enum Layout {
13+
static let titleLableLeadingSpacing: CGFloat = 20
14+
}
15+
16+
private let titleLabel = UILabel()
17+
18+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
19+
super.init(style: style, reuseIdentifier: reuseIdentifier)
20+
configureAttribute()
21+
configureLayout()
22+
}
23+
24+
required init?(coder: NSCoder) {
25+
fatalError("init(coder:) has not been implemented")
26+
}
27+
28+
func configure(title: String) {
29+
titleLabel.text = title
30+
}
31+
32+
func configureAttribute() {
33+
titleLabel.font = BitnagilFont(style: .body1, weight: .regular).font
34+
}
35+
36+
func configureLayout() {
37+
contentView.addSubview(titleLabel)
38+
39+
titleLabel.snp.makeConstraints { make in
40+
make.verticalEdges.equalToSuperview()
41+
make.leading.equalToSuperview().offset(Layout.titleLableLeadingSpacing)
42+
}
43+
}
44+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
//
2+
// BitnagilButtonTableViewCell.swift
3+
// Presentation
4+
//
5+
// Created by 이동현 on 7/30/25.
6+
//
7+
8+
import SnapKit
9+
import UIKit
10+
11+
protocol BitnagilButtonTableViewCellDelegate: AnyObject {
12+
func bitnagilButtonTableViewCellDidTapButton(_ sender: BitnagilButtonTableViewCell)
13+
}
14+
15+
final class BitnagilButtonTableViewCell: BitnagilBaseTableViewCell {
16+
private enum Layout {
17+
static let buttonTrailingSpacing: CGFloat = 20
18+
static let buttonHeight: CGFloat = 30
19+
static let buttonPadding: CGFloat = 10
20+
static let buttonCornerRadius: CGFloat = 4
21+
}
22+
23+
private let button = UIButton()
24+
private var buttonWidthConstraint: Constraint?
25+
weak var delegate: BitnagilButtonTableViewCellDelegate?
26+
27+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
28+
super.init(style: style, reuseIdentifier: reuseIdentifier)
29+
}
30+
31+
required init?(coder: NSCoder) {
32+
fatalError("init(coder:) has not been implemented")
33+
}
34+
35+
func configure(
36+
title: String,
37+
buttonTitle: String,
38+
isButtonEnabled: Bool
39+
) {
40+
super.configure(title: title)
41+
42+
let font = BitnagilFont.init(style: .body2, weight: .semiBold).font
43+
let textAttribute = [NSAttributedString.Key.font: font]
44+
let textWidth = (buttonTitle as NSString).size(withAttributes: textAttribute).width
45+
let buttonWidth = textWidth + Layout.buttonPadding * 2
46+
47+
buttonWidthConstraint?.update(offset: buttonWidth)
48+
button.setTitle(buttonTitle, for: .normal)
49+
button.isEnabled = isButtonEnabled
50+
51+
if isButtonEnabled {
52+
button.backgroundColor = BitnagilColor.lightBlue100
53+
button.setTitleColor(BitnagilColor.navy500, for: .normal)
54+
} else {
55+
button.backgroundColor = BitnagilColor.gray98
56+
button.setTitleColor(BitnagilColor.gray70, for: .disabled)
57+
}
58+
}
59+
60+
override func configureAttribute() {
61+
super.configureAttribute()
62+
63+
button.titleLabel?.font = BitnagilFont.init(style: .body2, weight: .semiBold).font
64+
button.layer.cornerRadius = Layout.buttonCornerRadius
65+
button.addAction(
66+
UIAction { [weak self] _ in
67+
guard let self else { return }
68+
self.delegate?.bitnagilButtonTableViewCellDidTapButton(self)
69+
},
70+
for: .touchUpInside)
71+
}
72+
73+
override func configureLayout() {
74+
super.configureLayout()
75+
76+
contentView.addSubview(button)
77+
78+
button.snp.makeConstraints { make in
79+
make.centerY.equalToSuperview()
80+
make.trailing.equalToSuperview().inset(Layout.buttonTrailingSpacing)
81+
make.height.equalTo(Layout.buttonHeight)
82+
buttonWidthConstraint = make.width
83+
.equalTo(Layout.buttonPadding)
84+
.constraint
85+
}
86+
}
87+
}

Projects/Presentation/Sources/MyPage/View/Component/MypageTableViewCell.swift renamed to Projects/Presentation/Sources/Common/Component/TableViewCell/BitnagilChevronTableViewCell.swift

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,47 @@
11
//
2-
// MyPageTableViewCell.swift
2+
// BitnagilChevronTableViewCell.swift
33
// Presentation
44
//
5-
// Created by 이동현 on 7/17/25.
5+
// Created by 이동현 on 7/30/25.
66
//
77

88
import SnapKit
99
import UIKit
1010

11-
final class MypageTableViewCell: UITableViewCell {
11+
final class BitnagilChevronTableViewCell: BitnagilBaseTableViewCell {
1212
private enum Layout {
13-
static let titleLableLeadingSpacing: CGFloat = 20
14-
static let titleLableTrailingSpacing: CGFloat = 8
1513
static let chevronImageViewTrailingSpacing: CGFloat = 16
1614
static let chevronImageViewSize: CGFloat = 16
1715
}
1816

19-
private let titleLabel = UILabel()
2017
private let chevronImageView = UIImageView()
2118

2219
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
2320
super.init(style: style, reuseIdentifier: reuseIdentifier)
24-
configureAttribute()
25-
configureLayout()
2621
}
27-
22+
2823
required init?(coder: NSCoder) {
2924
fatalError("init(coder:) has not been implemented")
3025
}
3126

32-
func configure(title: String) {
33-
titleLabel.text = title
34-
}
35-
36-
private func configureAttribute() {
37-
titleLabel.font = BitnagilFont(style: .body1, weight: .regular).font
27+
override func configureAttribute() {
28+
super.configureAttribute()
3829

3930
chevronImageView.tintColor = .black
4031
chevronImageView.image = BitnagilIcon
4132
.chevronIcon(direction: .right)?
4233
.withRenderingMode(.alwaysTemplate)
4334
}
4435

45-
private func configureLayout() {
46-
contentView.addSubview(titleLabel)
36+
override func configureLayout() {
37+
super.configureLayout()
38+
4739
contentView.addSubview(chevronImageView)
4840

4941
chevronImageView.snp.makeConstraints { make in
5042
make.centerY.equalToSuperview()
5143
make.trailing.equalToSuperview().inset(Layout.chevronImageViewTrailingSpacing)
5244
make.size.equalTo(Layout.chevronImageViewSize)
5345
}
54-
55-
titleLabel.snp.makeConstraints { make in
56-
make.verticalEdges.equalToSuperview()
57-
make.leading.equalToSuperview().offset(Layout.titleLableLeadingSpacing)
58-
make.trailing.equalTo(chevronImageView.snp.leading).offset(-Layout.titleLableTrailingSpacing)
59-
}
6046
}
6147
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//
2+
// BitnagilToggleTableViewCell.swift
3+
// Presentation
4+
//
5+
// Created by 이동현 on 7/30/25.
6+
//
7+
8+
import SnapKit
9+
import UIKit
10+
11+
protocol BitnagilToggleTableViewCellDelegate: AnyObject {
12+
func bitnagilToggleTableViewCellDidToggle(_ sender: BitnagilToggleTableViewCell, isOn: Bool)
13+
}
14+
15+
final class BitnagilToggleTableViewCell: BitnagilBaseTableViewCell {
16+
private enum Layout {
17+
static let switchTrailingSpacing: CGFloat = 20
18+
static let switchHeight: CGFloat = 24
19+
static let switchWidth: CGFloat = 44
20+
}
21+
22+
private let toggleSwitch = UISwitch()
23+
weak var delegate: BitnagilToggleTableViewCellDelegate?
24+
25+
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
26+
super.init(style: style, reuseIdentifier: reuseIdentifier)
27+
}
28+
29+
required init?(coder: NSCoder) {
30+
fatalError("init(coder:) has not been implemented")
31+
}
32+
33+
override func configureAttribute() {
34+
super.configureAttribute()
35+
36+
toggleSwitch.onTintColor = BitnagilColor.navy500
37+
toggleSwitch.tintColor = BitnagilColor.gray95
38+
toggleSwitch.addAction(UIAction { [weak self] action in
39+
guard let self = self else { return }
40+
self.delegate?.bitnagilToggleTableViewCellDidToggle(self, isOn: toggleSwitch.isOn)
41+
}, for: .valueChanged)
42+
}
43+
44+
override func configureLayout() {
45+
super.configureLayout()
46+
47+
contentView.addSubview(toggleSwitch)
48+
49+
toggleSwitch.snp.makeConstraints { make in
50+
make.centerY.equalToSuperview()
51+
make.trailing.equalToSuperview().inset(Layout.switchTrailingSpacing)
52+
make.height.equalTo(Layout.switchHeight)
53+
make.width.equalTo(Layout.switchWidth)
54+
}
55+
}
56+
57+
func configureToggleState(isOn: Bool) {
58+
toggleSwitch.isOn = isOn
59+
}
60+
}

Projects/Presentation/Sources/Common/DesignSystem/BitnagilIcon.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum BitnagilIcon {
4040

4141
// MARK: - Mypage Icons
4242
static let settingIcon = UIImage(named: "setting_icon", in: bundle, with: nil)
43-
43+
static let exclamationFilledIcon = UIImage(named: "exclamation_filled_icon", in: bundle, with: nil)
4444
// MARK: - Routine Creation Icons
4545
static let asteriskIcon = UIImage(named: "asterisk_icon", in: bundle, with: nil)
4646
static let deleteIcon = UIImage(named: "delete_icon", in: bundle, with: nil)

Projects/Presentation/Sources/Common/Extension/UIViewController+.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ import UIKit
1010
extension UIViewController {
1111
// MARK: - NavigationBar
1212
func configureNavigationBar(navigationStyle: NavigationBarStyle) {
13+
let appearance = UINavigationBarAppearance()
14+
appearance.backgroundEffect = .none
15+
appearance.configureWithOpaqueBackground()
16+
appearance.shadowColor = .clear
17+
navigationController?.navigationBar.standardAppearance = appearance
18+
navigationController?.navigationBar.scrollEdgeAppearance = appearance
19+
1320
switch navigationStyle {
1421
case .hidden:
1522
navigationController?.setNavigationBarHidden(true, animated: false)

0 commit comments

Comments
 (0)