Skip to content

Conversation

@thingineeer
Copy link
Member

@thingineeer thingineeer commented Feb 22, 2025

🩵 Issue

close #259


💙 변경된 내용

  • 새로운 커스텀 버튼을 다시 만들었어요!

    • 필요한 기능을 구현했는데, 추가해야 할 사항이 있으면 알려주세요! @wjdalswl
    • 새로운 커스텀 버튼으로 기존에 사용하는 버튼들을 수정해 주었어요!
  • 기존 파일은 삭제 했어요!


🅿️ PR Point

  • 기존 코드의 문제점
    • 중복로직이 너무 많음
    • 필요없는 로직이 많음
    • 꼭 필요한 pressed 커스텀을 못했음

1. 새로운 커스텀 버튼

꼭 필요한, title, font, radius 만 생성자로 받아줍니다. (디폴트 값이 존재하기 때문에 타이틀만 정해줘도 됩니다.

[TerningCustomButton의 생성자]

// MARK: - Init

init(
    title: String,
    font: UIFont = .button0,
    radius: CGFloat = 0
) {
    self.title = title
    self.font = font
    self.radius = radius
}

2. Enabled 처리는 메서드 체이닝 방식 (디폴트 true)

private let button = TerningCustomButton(title: "색상 변경하기", font: .button3, radius: 5).setEnabled(false)

3. 상태값에 따른 배경색 변경은 메서드를 활용하면 됩니다.

  • 5개의 파라미터가 존재하는데, 문서 읽어보면 이해할 수 있을 거예요
  • 기본값을 전부 넣어둬서, 필요한 부분만 메서드를 사용해서 변화를 주세요!
button.setAppearance(
    disabledBackgroundColor: .white,
    textDisabled: .grey375
)

4. 생성자로 주입해준 title에서 새로운 title로 변경하고 싶을때

button.updateTitle("새로운 버튼 타이틀")

📘 ScreenShot

커스텀 버튼 사용하는 일부 뷰 캡처

알람 창 회원탈퇴

@thingineeer thingineeer added 명진 🍀 Feat ✨ 새로운 기능 구현 labels Feb 22, 2025
@thingineeer thingineeer requested a review from wjdalswl February 22, 2025 09:03
@thingineeer thingineeer self-assigned this Feb 22, 2025
Copy link
Member

@wjdalswl wjdalswl left a comment

Choose a reason for hiding this comment

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

확인했습니다!! 수고하셨습니당! 혹시 borderColor를 안넣은 이유는 따로 있을까요!?

@thingineeer
Copy link
Member Author

thingineeer commented Feb 23, 2025

@wjdalswl
질문은 리뷰 파일 conversation에 달면 좋을 거 같아요!

이유는 현재 디자인 시스템에서 BorderColor 를 사용하지 않는 부분이 더 많기 때문에 커스텀 버튼에 넣기에는 과한 리소스라고 판단했습니다.!

필요할때 아래 처럼 코드 추가하면 될 것 같아요!

button.makeBorder(width: 1, color: .grey150, cornerRadius: 5)

@thingineeer thingineeer merged commit 47006e2 into main Feb 23, 2025
@thingineeer thingineeer deleted the Feat/#259-CustomButton branch February 23, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat ✨ 새로운 기능 구현 명진 🍀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] - 기존에 있던 CustomButton을 제거하고 다시 개발 합니다.

3 participants