-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat [#9] 커스텀 버튼 구현 #10
Merged
+214
−0
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d80818f
Merge branch 'develop' into feat/#9-customButtonUI
kim-seonwoo 85764cb
[Add/#9] Onboarding - OnboardingButton 추가
kim-seonwoo b3db8af
[Feat/#9] Onboarding - button font와 color 추가
kim-seonwoo 05663c9
[Fix/#9] Onboarding - button parameter명 변경
kim-seonwoo 15de001
[Add/#9] Common - HMHSelectButton 파일 추가
kim-seonwoo 5bf28a2
[Feat/#9] Common - HMHSelectButton 기능구현
kim-seonwoo 5ad5fe1
[Feat/#9] Common - HMHSelectButton 다중 선택 타입 구현
kim-seonwoo ceda468
[Feat/#9] Onboarding - button isEnabled로직 추가
kim-seonwoo bcf7f69
[Fix/#9] Common - HMHSelectButton 코드리뷰 반영
kim-seonwoo f6fc57e
[Fix/#9] Onboarding - OnboardingButton 코드리뷰 반영
kim-seonwoo 312c619
[Fix/#9] Onboarding - 커스텀버튼 2차 코드리뷰 반영
kim-seonwoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Add/#9] Onboarding - OnboardingButton 추가
commit 85764cb16116872cf99088adf293159bfbe073b0
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
HMH_iOS/HMH_iOS/Presentation/Onboarding/Views/OnboardingButton.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// OnboardingButton.swift | ||
// HMH_iOS | ||
// | ||
// Created by Seonwoo Kim on 1/3/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
import Then | ||
|
||
final class OnboardingButton: UIButton { | ||
@frozen | ||
enum OnboardingButtonType { | ||
case enable | ||
case disabled | ||
} | ||
|
||
private var type: OnboardingButtonType = .enable | ||
|
||
private let buttonTitleLabel = UILabel().then { | ||
$0.textColor = .white | ||
$0.font = UIFont.iosText3Semibold18 | ||
$0.isHidden = true | ||
} | ||
|
||
init(leftItem type: OnboardingButtonType, buttonText: String) { | ||
super.init(frame: .zero) | ||
self.type = type | ||
buttonTitleLabel.text = buttonText | ||
|
||
configureButton() | ||
setUI() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setUI() { | ||
setHierarchy() | ||
setConstraints() | ||
} | ||
|
||
private func setHierarchy() { | ||
self.addSubview(buttonTitleLabel) | ||
} | ||
|
||
private func setConstraints() { | ||
buttonTitleLabel.snp.makeConstraints { | ||
$0.center.equalToSuperview() | ||
} | ||
} | ||
|
||
private func configureButton() { | ||
self.do { | ||
$0.makeCornerRound(radius: 6.adjustedHeight) | ||
$0.layer.cornerCurve = .continuous | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P4. 여기도 위와 마찬가지로 |
||
switch type { | ||
case .enable: | ||
self.do { | ||
$0.backgroundColor = .purple | ||
} | ||
case .disabled: | ||
self.do { | ||
$0.backgroundColor = .gray | ||
} | ||
} | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5. 소소하지만 .. case naming 혹시
enabled
는 어떠신가요?disabled
와 맞추는 게 좋아보여서요!