Skip to content

Commit 95b33c9

Browse files
authored
Merge pull request #69 from YAPP-Github/BOOK-119-feature/#67
feat: 입력 관련 컴포넌트 추가, 디자인 시스템 일부 수정
2 parents c4b7b29 + 987e6c3 commit 95b33c9

176 files changed

Lines changed: 1383 additions & 66 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ios_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
shell: bash
8484

8585
- name: 🧱 Initialize Tuist module structure
86-
working-directory: src
86+
working-directory: src/SupportingFiles/Scripts
8787
run: |
8888
chmod +x tuist_module_init.sh
8989
./tuist_module_init.sh
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+
class BaseView: UIView {
6+
// MARK: - Initialize
7+
override init(frame: CGRect = .zero) {
8+
super.init(frame: frame)
9+
self.setupView()
10+
self.setupLayout()
11+
self.configure()
12+
}
13+
14+
@available(*, unavailable)
15+
required init?(coder: NSCoder) {
16+
fatalError("init(coder:) has not been implemented")
17+
}
18+
19+
// MARK: - Common Methods
20+
func setupView() {}
21+
func setupLayout() {}
22+
func configure() {}
23+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import UIKit
4+
5+
class BaseViewController<T: BaseView>: UIViewController {
6+
// MARK: - Properties
7+
let contentView: T
8+
9+
// MARK: - Initialize
10+
init() {
11+
self.contentView = T()
12+
super.init(nibName: nil, bundle: nil)
13+
}
14+
15+
@available(*, unavailable)
16+
required init?(coder: NSCoder) {
17+
fatalError("init(coder:) has not been implemented")
18+
}
19+
20+
// MARK: - Life Cycle
21+
override func loadView() {
22+
if contentView.backgroundColor == nil {
23+
contentView.backgroundColor = .white
24+
}
25+
view = contentView
26+
}
27+
28+
override func viewDidLoad() {
29+
super.viewDidLoad()
30+
31+
self.setupView()
32+
self.configure()
33+
self.setupLayout()
34+
self.bindAction()
35+
self.bindState()
36+
}
37+
38+
// MARK: - Common Methods
39+
func setupView() {}
40+
func configure() {}
41+
func setupLayout() {}
42+
func bindAction() {}
43+
func bindState() {}
44+
}

src/Projects/BKDesign/PreviewApp/Sources/SceneDelegate.swift

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import UIKit
55

66
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
77
var window: UIWindow?
8+
let navigationController = UINavigationController()
89

910
func scene(
1011
_ scene: UIScene,
@@ -13,12 +14,43 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
1314
) {
1415
guard let windowScene = scene as? UIWindowScene else { return }
1516

16-
let window = UIWindow(windowScene: windowScene)
17-
let viewController = BKButtonTestViewController()
18-
// let viewController = BKButtonGroupDemoViewController()
19-
window.rootViewController = UINavigationController(rootViewController: viewController)
20-
window.makeKeyAndVisible()
17+
setupNavigationBar()
18+
window = UIWindow(windowScene: windowScene)
19+
window?.rootViewController = navigationController
20+
window?.makeKeyAndVisible()
2121

22-
self.window = window
22+
navigationController.pushViewController(CatalogViewController(), animated: true)
23+
}
24+
25+
func setupNavigationBar() {
26+
guard let font = BKTextStyle.headline2(weight: .semiBold).uiFont else { return }
27+
let appearance = UINavigationBarAppearance()
28+
appearance.configureWithDefaultBackground()
29+
appearance.titleTextAttributes = [
30+
.foregroundColor: UIColor.bkContentColor(.primary),
31+
.font: font
32+
]
33+
appearance.backgroundColor = .bkBaseColor(.primary)
34+
appearance.shadowColor = .clear
35+
36+
let barButtonAppearance = UIBarButtonItemAppearance()
37+
barButtonAppearance.normal.titleTextAttributes = [
38+
.foregroundColor: UIColor.clear
39+
]
40+
41+
let backButtonImage = BKImage.Icon.chevronLeft
42+
.withRenderingMode(.alwaysTemplate)
43+
.withAlignmentRectInsets(
44+
UIEdgeInsets(top: 0, left: -16, bottom: 0, right: 0)
45+
)
46+
47+
appearance.backButtonAppearance = barButtonAppearance
48+
appearance.setBackIndicatorImage(backButtonImage, transitionMaskImage: backButtonImage)
49+
50+
navigationController.navigationBar.tintColor = .bkContentColor(.primary)
51+
navigationController.navigationBar.standardAppearance = appearance
52+
navigationController.navigationBar.scrollEdgeAppearance = appearance
53+
navigationController.navigationBar.compactAppearance = appearance
54+
navigationController.navigationBar.isTranslucent = false
2355
}
2456
}

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonGroupDemoViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public final class BKButtonGroupDemoViewController: UIViewController {
1515
setupScrollView()
1616
setupDemoGroups()
1717
}
18+
19+
public override func viewWillAppear(_ animated: Bool) {
20+
super.viewWillAppear(animated)
21+
navigationItem.title = "Button"
22+
}
1823

1924
private func setupScrollView() {
2025
view.addSubview(scrollView)

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public final class BKButtonTestViewController: UIViewController {
1616
super.viewDidLoad()
1717
view.backgroundColor = .white
1818
setupScrollView()
19-
// setupIndependentButtons()
2019
setupStackView()
2120
}
2221

2322
public override func viewWillAppear(_ animated: Bool) {
2423
super.viewWillAppear(animated)
24+
navigationItem.title = "Button Tests"
2525
setupAllTestButtons()
2626
}
2727

@@ -59,9 +59,9 @@ public final class BKButtonTestViewController: UIViewController {
5959
addButton("Secondary", style: .secondary, size: size)
6060
addButton("Tertiary", style: .tertiary, size: size)
6161

62-
addIconButton("Apple 로그인", style: .primary, size: size, left: .appleLogo)
63-
addIconButton("카카오 로그인", style: .primary, size: size, right: .kakaoLogo)
64-
addIconButton("양쪽 아이콘", style: .primary, size: size, left: .appleLogo, right: .kakaoLogo)
62+
addIconButton("Apple 로그인", style: .primary, size: size, left: BKImage.Icon.apple)
63+
addIconButton("카카오 로그인", style: .primary, size: size, right: BKImage.Icon.kakao)
64+
addIconButton("양쪽 아이콘", style: .primary, size: size, left: BKImage.Icon.apple, right: BKImage.Icon.kakao)
6565
}
6666

6767
// MARK: - Button Builders
@@ -76,13 +76,13 @@ public final class BKButtonTestViewController: UIViewController {
7676
_ title: String,
7777
style: BKButtonStyle,
7878
size: BKButtonSize,
79-
left: BKIcon? = nil,
80-
right: BKIcon? = nil
79+
left: UIImage? = nil,
80+
right: UIImage? = nil
8181
) {
8282
let button = BKButton(style: style, size: size)
8383
button.title = "[\(size.label)] \(title)"
84-
button.leftIcon = left?.image
85-
button.rightIcon = right?.image
84+
button.leftIcon = left
85+
button.rightIcon = right
8686
containerView.addArrangedSubview(button)
8787
}
8888

@@ -104,8 +104,8 @@ public final class BKButtonTestViewController: UIViewController {
104104
.tertiary(title: "[Free] Tertiary", size: .rounded)
105105
]
106106

107-
buttons[0].leftIcon = BKIcon.appleLogo.image
108-
buttons[2].rightIcon = BKIcon.kakaoLogo.image
107+
buttons[0].leftIcon = BKImage.Icon.apple
108+
buttons[2].rightIcon = BKImage.Icon.kakao
109109

110110
var last: UIView?
111111
for button in buttons {
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import BKDesign
4+
import SnapKit
5+
import UIKit
6+
7+
final class BKInputCatalogView: BaseView {
8+
private let contentView = UIView()
9+
private let scrollView: UIScrollView = {
10+
let scrollView = UIScrollView()
11+
scrollView.alwaysBounceVertical = true
12+
scrollView.alwaysBounceHorizontal = false
13+
scrollView.showsHorizontalScrollIndicator = false
14+
return scrollView
15+
}()
16+
17+
private let stackView: UIStackView = {
18+
let stackView = UIStackView()
19+
stackView.axis = .vertical
20+
stackView.spacing = BKSpacing.spacing5
21+
stackView.alignment = .fill
22+
return stackView
23+
}()
24+
25+
private let mediumLabel = BKLabel(
26+
text: "Medium Label",
27+
type: .medium
28+
)
29+
30+
private let smallLabel = BKLabel(
31+
text: "small label",
32+
type: .small
33+
)
34+
35+
private let labelDivider = BKDivider(type: .medium)
36+
private let checkBoxStackView: UIStackView = {
37+
let stackView = UIStackView()
38+
stackView.axis = .horizontal
39+
stackView.spacing = BKSpacing.spacing2
40+
stackView.alignment = .leading
41+
stackView.distribution = .equalCentering
42+
return stackView
43+
}()
44+
45+
private let rectangleCheckBox = BKCheckBox(type: .rectangle)
46+
private let roundCheckBox = BKCheckBox(type: .round)
47+
private let checkBoxSpacer = UIView()
48+
49+
private let checkBoxDivider = BKDivider(type: .medium)
50+
51+
private let normalBaseTextField = BKBaseTextField(
52+
placeholder: "여기에 텍스트가 들어갑니다.",
53+
type: .normal
54+
)
55+
56+
private let brandBaseTextField = BKBaseTextField(
57+
placeholder: "여기에 텍스트가 들어갑니다.",
58+
type: .brand
59+
)
60+
61+
private let errorBaseTextField = BKBaseTextField(
62+
placeholder: "여기에 텍스트가 들어갑니다.",
63+
type: .error
64+
)
65+
66+
private let searchTextFieldDivider = BKDivider(type: .small)
67+
68+
private let searchTextField = BKSearchTextField(
69+
placeholder: "여기에 텍스트가 들어갑니다.",
70+
type: .brand
71+
)
72+
73+
private let textFieldDivider = BKDivider(type: .small)
74+
75+
private let textField = BKTextView(
76+
labelText: "BKTextField",
77+
placeholder: "여기에 텍스트가 들어갑니다.",
78+
helpMessage: "Help message",
79+
isError: false
80+
)
81+
82+
private let textFieldWithError = BKTextView(
83+
labelText: "BKTextField",
84+
placeholder: "에러가 발생한 TextField.",
85+
helpMessage: "Help message",
86+
isError: true
87+
)
88+
89+
override func setupView() {
90+
addSubview(scrollView)
91+
92+
scrollView.addSubview(contentView)
93+
contentView.addSubview(stackView)
94+
95+
stackView.addArrangedSubview(mediumLabel)
96+
stackView.addArrangedSubview(smallLabel)
97+
stackView.addArrangedSubview(labelDivider)
98+
99+
checkBoxStackView.addArrangedSubview(rectangleCheckBox)
100+
checkBoxStackView.addArrangedSubview(roundCheckBox)
101+
checkBoxStackView.addArrangedSubview(checkBoxSpacer)
102+
stackView.addArrangedSubview(checkBoxStackView)
103+
104+
stackView.addArrangedSubview(checkBoxDivider)
105+
106+
stackView.addArrangedSubview(normalBaseTextField)
107+
stackView.addArrangedSubview(brandBaseTextField)
108+
stackView.addArrangedSubview(errorBaseTextField)
109+
110+
stackView.addArrangedSubview(searchTextFieldDivider)
111+
112+
stackView.addArrangedSubview(searchTextField)
113+
114+
stackView.addArrangedSubview(textFieldDivider)
115+
stackView.addArrangedSubview(textField)
116+
stackView.addArrangedSubview(textFieldWithError)
117+
}
118+
119+
override func configure() {
120+
backgroundColor = .white
121+
}
122+
123+
override func setupLayout() {
124+
scrollView.snp.makeConstraints {
125+
$0.edges.equalToSuperview()
126+
}
127+
128+
contentView.snp.makeConstraints {
129+
$0.edges.equalTo(scrollView.contentLayoutGuide)
130+
$0.width.equalTo(scrollView.frameLayoutGuide)
131+
}
132+
133+
stackView.snp.makeConstraints {
134+
$0.edges.equalToSuperview()
135+
.inset(BKInset.inset20)
136+
}
137+
}
138+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright © 2025 Booket. All rights reserved
2+
3+
import UIKit
4+
5+
final class BKInputCatalogViewController: BaseViewController<BKInputCatalogView> {
6+
override func viewWillAppear(_ animated: Bool) {
7+
super.viewWillAppear(animated)
8+
navigationItem.title = "Label, TextField"
9+
}
10+
}

0 commit comments

Comments
 (0)