Skip to content

Commit

Permalink
Merge pull request #571 from wakmusic/570-wmnavigationbar-title-is-no…
Browse files Browse the repository at this point in the history
…t-working

🔀 :: [#570] WMNavigationBarView / titleLabel에 text 및 색 지정
  • Loading branch information
baekteun authored Jun 5, 2024
2 parents bb3fe5a + 9ecf29b commit a8b54bf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
}
}
],
"version" : 2
"version" : 3
}
1 change: 1 addition & 0 deletions Projects/Features/BaseFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ let project = Project.module(
.domain(target: .AuthDomain, type: .interface),
.domain(target: .PlayListDomain, type: .interface),
.domain(target: .UserDomain, type: .interface),
.module(target: .ErrorModule),
.Project.Module.FeatureThirdPartyLib,
.Project.UserInterfaces.DesignSystem,
.Project.Module.Utility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public final class WMNavigationBarView: UIView {
$0.alignment = .leading
}

public private(set) var titleView = UIView()
public private(set) var titleView: UIView = UIView()
private let rightStackView = UIStackView().then {
$0.isUserInteractionEnabled = true
$0.axis = .horizontal
Expand All @@ -30,14 +30,31 @@ public final class WMNavigationBarView: UIView {
fatalError("init(coder:) has not been implemented")
}

public func setTitle(_ text: String) {
public func setTitle(
_ text: String,
textColor: UIColor = DesignSystemAsset.NewGrayColor.gray900.color
) {
let titleLabel = UILabel()
titleLabel.text = text
titleLabel.font = .setFont(.t5(weight: .medium))
titleLabel.textColor = textColor
titleView.removeFromSuperview()
self.titleView = titleLabel

self.addSubview(titleView)
titleView.snp.remakeConstraints {
$0.center.equalToSuperview()
}
}

public func setTitleView(_ view: UIView) {
titleView.removeFromSuperview()
self.titleView = view

self.addSubview(titleView)
titleView.snp.remakeConstraints {
$0.center.equalToSuperview()
}
}

public func setRightViews(_ views: [UIView]) {
Expand All @@ -60,7 +77,6 @@ public final class WMNavigationBarView: UIView {
private extension WMNavigationBarView {
func addView() {
self.addSubview(leftStackView)
self.addSubview(titleView)
self.addSubview(rightStackView)
}

Expand All @@ -69,9 +85,6 @@ private extension WMNavigationBarView {
$0.left.equalToSuperview().inset(horizontalInset)
$0.centerY.equalToSuperview()
}
titleView.snp.makeConstraints {
$0.center.equalToSuperview()
}
rightStackView.snp.makeConstraints {
$0.right.equalToSuperview().inset(horizontalInset)
$0.centerY.equalToSuperview()
Expand Down

0 comments on commit a8b54bf

Please sign in to comment.