Skip to content
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 [#18] CustomAlertView 구현 #23

Merged
merged 11 commits into from
Jan 7, 2024
Merged

Conversation

boyeon0119
Copy link
Contributor

👾 작업 내용

  • Alert에 사용되는 커스텀 버튼을 타입별로 우선 구현하였습니다.
  • 그리고 이 버튼을 사용해 로그아웃, 회원탈퇴 Alert을 구현했습니다.
  • 나머지 Alert들은 추후에 제작할 예정입니다.

🚀 PR Point

CustomAlertButton 구현

enum HMHAlertButtonType {
        case disabled
        case enabled
    }
  • 다음과 같이 두 가지 타입으로 나눠 케이스별로 코드를 짰습니다.

Alert 구현

  • 로그아웃과 회원탈퇴 Alert을 나눠서 UI를 그렸습니다.

AlertViewController 구현

  • 두 AlertView들을 불러오는 AlertViewController를 짰습니다.
  • protocol로 버튼 메서드를 따로 뺐습니다.
protocol AlertDelegate: AnyObject {
    func enabledButtonTapped()
    func alertDismissTapped()
}
  • 그리고 아래와 같이 Delegate를 통해 버튼을 동작하게 했습니다.
  • 추후에 다른 동작들도 넣을 예정입니다.
extension AlertViewController: AlertDelegate {
    func enabledButtonTapped() {
        dismiss(animated: false) {
            (self.okAction ?? self.emptyActions)()
        }
    }
    
    func alertDismissTapped() {
        dismiss(animated: true)
    }
}
  • 아래와 같이 선언되는 뷰컨트롤러에서 어떤 종류의 Alert이 보여질지를 타입을 통해 나눴습니다.
private func setAlertType() {
        switch alertType {
        case .HMHLogoutAlert:
            setAlertView(logout: true, quit: false)
        case .HMHQuitALert:
            setAlertView(logout: false, quit: true)
        default:
            break
        }
    }

📸 스크린샷

구현 내용 스크린샷
커스텀알럿 구현

✅ Issue

Resolved #18

@boyeon0119 boyeon0119 added 🙊보연 보연의 issue 🌈 feat 기능 구현 🎨 style 커스텀 뷰 짜기 labels Jan 6, 2024
@boyeon0119 boyeon0119 added this to the 🚀1차 스프린트🚀 milestone Jan 6, 2024
@boyeon0119 boyeon0119 self-assigned this Jan 6, 2024
Copy link
Member

@Zoe0929 Zoe0929 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3. 정말정말 고생하셨습니다 😭❤️

enum HMHAlertButtonType {
case disabled
case enabled
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4. enum 아래 한 줄 띄어쓰기 하면 보기 더 좋을 것 같아요!


private func setConstraints() {
self.snp.makeConstraints {
$0.height.equalTo(44)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3. 여기 adjusted 붙이지 않은 이유가 있을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그런 이유는 없슴니다 ㅋ

}

private func configureButton() {
self.layer.cornerRadius = 6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3. 여기도 adjusted !

Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3. 구현 수고 많으셨습니다 ~ 😎

$0.horizontalEdges.equalToSuperview()
}

buttonStackView.snp.makeConstraints {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p4.여기도 adjusted가능할 것 같습니다!

@boyeon0119 boyeon0119 merged commit 76dcaba into develop Jan 7, 2024
@Zoe0929 Zoe0929 deleted the feat/#18-CustomAlertView branch June 12, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌈 feat 기능 구현 🎨 style 커스텀 뷰 짜기 🙊보연 보연의 issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] CustomAlert 구현
3 participants