Skip to content

Commit f3805b5

Browse files
authored
Merge pull request #79 from YAPP-Github/BOOK-130-feature/#78
feat: 설정 화면 구현
2 parents 6821ad1 + 9df8f04 commit f3805b5

14 files changed

Lines changed: 573 additions & 4 deletions

File tree

src/Projects/BKDomain/Sources/DomainAssembly.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,11 @@ public struct DomainAssembly: Assembly {
5353
authRepository: repository
5454
)
5555
}
56+
57+
container.register(
58+
type: AppVersionUseCase.self
59+
) { _ in
60+
return DefaultAppVersionUseCase()
61+
}
5662
}
5763
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import Combine
4+
5+
/// 앱 버전을 반환합니다.
6+
public protocol AppVersionUseCase {
7+
func execute() -> AnyPublisher<String, Never>
8+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import Combine
4+
import Foundation
5+
6+
public struct DefaultAppVersionUseCase: AppVersionUseCase {
7+
public func execute() -> AnyPublisher<String, Never> {
8+
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "-"
9+
return Just(version).eraseToAnyPublisher()
10+
}
11+
}

src/Projects/BKPresentation/Sources/AppCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public final class AppCoordinator: Coordinator {
5454
parentCoordinator: self,
5555
navigationController: navigationController
5656
)
57-
// addChildCoordinator(mainFlowCoordinator)
57+
addChildCoordinator(mainFlowCoordinator)
5858
mainFlowCoordinator.start()
5959
}
6060
}

src/Projects/BKPresentation/Sources/AuthFlow/View/LoginViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import UIKit
88
final class LoginViewController: BaseViewController<LoginView> {
99
var cancellable: Set<AnyCancellable> = []
1010
let viewModel: AnyViewBindableViewModel<LoginViewModel.State, LoginViewModel.Action>
11-
weak var coordinator: LoginCoordinator?
1211

1312
init(viewModel: LoginViewModel) {
1413
self.viewModel = AnyViewBindableViewModel(viewModel)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import BKDesign
4+
import SnapKit
5+
import UIKit
6+
7+
final class BKDividerFooterView: UICollectionReusableView {
8+
static let kind = UICollectionView.elementKindSectionFooter
9+
static let identifier = "BKDividerFooterView"
10+
11+
override init(frame: CGRect) {
12+
super.init(frame: frame)
13+
14+
let divider = BKDivider()
15+
addSubview(divider)
16+
17+
divider.snp.makeConstraints {
18+
$0.edges.equalToSuperview()
19+
}
20+
}
21+
22+
required init?(coder: NSCoder) {
23+
fatalError("init(coder:) has not been implemented")
24+
}
25+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import Foundation
4+
5+
/// 디자인 시스템으로 가기 보다는, 특정 뷰들에 대해서 사용될 상수를 정의합니다.
6+
enum BKLayoutSize {
7+
static let icon: CGFloat = 24
8+
9+
enum Width {
10+
11+
}
12+
13+
enum Height {
14+
static let cell: CGFloat = 56
15+
}
16+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import SnapKit
4+
import UIKit
5+
6+
final class HomeViewController: UIViewController {
7+
weak var coordinator: MainFlowCoordinator?
8+
9+
private let settingButton: UIButton = {
10+
let button = UIButton(type: .system)
11+
button.setTitle("SettingViewController", for: .normal)
12+
return button
13+
}()
14+
15+
override func viewDidLoad() {
16+
super.viewDidLoad()
17+
title = "홈 화면"
18+
view.backgroundColor = .systemBackground
19+
configure()
20+
bindActions()
21+
}
22+
23+
private func configure() {
24+
let stack = UIStackView(arrangedSubviews: [
25+
settingButton
26+
])
27+
stack.axis = .vertical
28+
stack.spacing = 16
29+
stack.alignment = .center
30+
31+
view.addSubview(stack)
32+
33+
stack.snp.makeConstraints {
34+
$0.centerX.equalToSuperview()
35+
$0.centerY.equalToSuperview()
36+
}
37+
}
38+
39+
private func bindActions() {
40+
settingButton.addTarget(self, action: #selector(openSettings), for: .touchUpInside)
41+
}
42+
43+
@objc private func openSettings() {
44+
coordinator?.didTapSettingButton()
45+
}
46+
}

src/Projects/BKPresentation/Sources/MainFlow/MainFlowCoordinator.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import Foundation
44
import UIKit
55

6-
// TODO: - Placeholder 대신 넣은 파일입니다. 실제 MainFlow 개발 시작 시 삭제하세요.
76
final class MainFlowCoordinator: Coordinator {
87
weak var parentCoordinator: Coordinator?
98
var childCoordinators = [Coordinator]()
@@ -17,5 +16,20 @@ final class MainFlowCoordinator: Coordinator {
1716
self.navigationController = navigationController
1817
}
1918

20-
func start() { }
19+
func start() {
20+
let homeViewController = HomeViewController()
21+
homeViewController.coordinator = self
22+
navigationController.pushViewController(homeViewController, animated: true)
23+
}
24+
}
25+
26+
extension MainFlowCoordinator {
27+
func didTapSettingButton() {
28+
let settingCoordinator = SettingCoordinator(
29+
parentCoordinator: self,
30+
navigationController: navigationController
31+
)
32+
childCoordinators.append(settingCoordinator)
33+
settingCoordinator.start()
34+
}
2135
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import UIKit
4+
5+
final class SettingCoordinator: Coordinator {
6+
weak var parentCoordinator: Coordinator?
7+
var childCoordinators = [Coordinator]()
8+
var navigationController: UINavigationController
9+
10+
init(
11+
parentCoordinator: Coordinator?,
12+
navigationController: UINavigationController
13+
) {
14+
self.parentCoordinator = parentCoordinator
15+
self.navigationController = navigationController
16+
}
17+
18+
func start() {
19+
let settingViewController = SettingViewController(viewModel: SettingViewModel())
20+
settingViewController.coordinator = self
21+
navigationController.pushViewController(settingViewController, animated: true)
22+
}
23+
}

0 commit comments

Comments
 (0)