Skip to content

Commit

Permalink
[Feat/#34] Onboarding - 버튼 상태 설정 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-seonwoo committed Jan 9, 2024
1 parent 3e0ef57 commit 7cc37a4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,20 @@ import SnapKit
import Then

final class ProblemSurveyViewController: OnboardingBaseViewController {
private let surveyView = SurveyView()
private let surveyView = SurveyView(buttonType: .multiple)

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .background
nextButtonText = StringLiteral.OnboardingButton.next
nextButton.setButtonText(buttonTitle: nextButtonText)
surveyView.firstButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.firstSelect)
surveyView.secondButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.secondSelect)
surveyView.thirdButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.thirdSelect)
surveyView.fourthButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.fourthSelect)
mainTitleText = StringLiteral.OnboardigMain.problemSurvey
subTitleText = StringLiteral.OnboardigSub.problemSurvey

self.delegate = self
step = 2
setUI()
configureSurveyView()
}

override func viewDidAppear(_ animated: Bool) {
Expand All @@ -49,6 +46,14 @@ final class ProblemSurveyViewController: OnboardingBaseViewController {
$0.leading.trailing.equalTo(progressBar)
}
}

private func configureSurveyView() {
surveyView.firstButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.firstSelect)
surveyView.secondButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.secondSelect)
surveyView.thirdButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.thirdSelect)
surveyView.fourthButton.setButtonText(buttonTitle: StringLiteral.ProblemSurveySelect.fourthSelect)
}

}

extension ProblemSurveyViewController: HomeViewPushDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,19 @@ import SnapKit
import Then

final class TimeSurveyViewController: OnboardingBaseViewController {
private let surveyView = SurveyView()
private let surveyView = SurveyView(buttonType: .solitary)

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .background
nextButtonText = StringLiteral.OnboardingButton.next
nextButton.setButtonText(buttonTitle: nextButtonText)
surveyView.firstButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.firstSelect)
surveyView.secondButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.secondSelect)
surveyView.thirdButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.thirdSelect)
surveyView.fourthButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.fourthSelect)
mainTitleText = StringLiteral.OnboardigMain.TimeSurvey

self.delegate = self
step = 1
setUI()
configureSurveyView()
}

override func viewDidAppear(_ animated: Bool) {
Expand All @@ -48,6 +45,13 @@ final class TimeSurveyViewController: OnboardingBaseViewController {
$0.leading.trailing.equalTo(progressBar)
}
}

private func configureSurveyView() {
surveyView.firstButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.firstSelect)
surveyView.secondButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.secondSelect)
surveyView.thirdButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.thirdSelect)
surveyView.fourthButton.setButtonText(buttonTitle: StringLiteral.TimeSurveySelect.fourthSelect)
}
}

extension TimeSurveyViewController: HomeViewPushDelegate {
Expand Down
21 changes: 13 additions & 8 deletions HMH_iOS/HMH_iOS/Presentation/Onboarding/Views/SurveyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,21 @@ final class SurveyView: UIView {
var secondButtonText: String = ""
var thirdButtonText: String = ""
var fourthButtonText: String = ""
var buttonType: HMHSelectButton.HMHSelectButtonType = .solitary

lazy var firstButton = HMHSelectButton(buttonType: .solitary)
lazy var secondButton = HMHSelectButton(buttonType: .solitary)
lazy var thirdButton = HMHSelectButton(buttonType: .solitary)
lazy var fourthButton = HMHSelectButton(buttonType: .solitary)
lazy var firstButton = HMHSelectButton(buttonType: buttonType)
lazy var secondButton = HMHSelectButton(buttonType: buttonType)
lazy var thirdButton = HMHSelectButton(buttonType: buttonType)
lazy var fourthButton = HMHSelectButton(buttonType: buttonType)

override init(frame: CGRect) {
super.init(frame: frame)

init(buttonType: HMHSelectButton.HMHSelectButtonType) {
super.init(frame: .zero)
self.buttonType = buttonType

setAddTarget()
configureView()
setUI()
setButtonType(buttonType: buttonType)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
Expand Down Expand Up @@ -61,6 +65,7 @@ final class SurveyView: UIView {
private func setAddTarget() {
}

private func configureView() {
func setButtonType(buttonType: HMHSelectButton.HMHSelectButtonType) {
self.buttonType = buttonType
}
}

0 comments on commit 7cc37a4

Please sign in to comment.