Skip to content

feat: 버튼 컴포넌트 개발#68

Merged
clxxrlove merged 18 commits into
developfrom
BOOK-114-feature/#64
Jul 10, 2025
Merged

feat: 버튼 컴포넌트 개발#68
clxxrlove merged 18 commits into
developfrom
BOOK-114-feature/#64

Conversation

@doyeonk429
Copy link
Copy Markdown
Member

@doyeonk429 doyeonk429 commented Jul 9, 2025

🔗 관련 이슈

📘 작업 유형

  • ✨ Feature (기능 추가)
  • 🐞 Bugfix (버그 수정)
  • 🔧 Refactor (코드 리팩토링)
  • ⚙️ Chore (환경 설정)
  • 📝 Docs (문서 작성 및 수정)
  • ✅ Test (기능 테스트)
  • 🎨 style (코드 스타일 수정)

📙 작업 내역

  • BKButton 시스템 구축: BKDesign 내부에서 일관된 버튼 사용을 위한 커스터마이징 가능한 BKButton 시스템을 구현하였습니다. 각 구성 요소를 독립적으로 정의하고, 조합하여 유연하게 사용할 수 있도록 설계하였습니다.

1. BKButton 구성요소 분리 정의

  • BKButtonProtocol: 버튼 공통 프로퍼티 정의
  • BKButtonStyle: 스타일 (primary, secondary, tertiary)
  • BKButtonSize: 사이즈 (small, medium, large, rounded)
  • BKButtonState: 상태 (normal, pressed, disabled)
  • BKButtonConfiguration: 구성 정보 구조체 (builder 패턴)

2. 기능 구현

  • BKButton: 구성 정보를 바탕으로 버튼 구성
  • 상태에 따라 색상, 아이콘, 코너 반경, 애니메이션 자동 적용
  • 아이콘 리사이징을 위한 UIImage 익스텐션 추가
  • 커스텀 색상 사용 가능하도록 .custom(background:foreground:) 스타일 추가

3. Button Group 시스템

  • BKButtonGroup: 여러 개의 버튼을 수평/수직/동일너비 레이아웃으로 구성
  • twoButtonGroup, threeButtonGroup, verticalButtonGroup 등 다양한 static 생성자 제공

4. 테스트 뷰컨트롤러

  • BKButtonGroupDemoViewController 구현
  • 다양한 스타일/사이즈 조합으로 버튼 렌더링 테스트 가능
  • 버튼 클릭 시 로그로 확인 가능

기타 작업

  • SetNeeds property wrapper 추가
  • 구조 폴더링 및 네이밍 정비
  • 문서화 주석 (SwiftDoc) 일부 적용

🧪 테스트 내역

  • 브라우저/기기에서 동작 확인
  • 엣지 케이스 테스트 완료
  • 기존 기능 영향 없음

🎨 스크린샷 또는 시연 영상 (선택)

기능 미리보기 기능 미리보기
iPhone 16 Pro
iPhone 13
iPhone SE
iPhone SE
기능 미리보기
애니메이션

✅ PR 체크리스트

  • 커밋 메시지가 명확합니다
  • PR 제목이 컨벤션에 맞습니다
  • 관련 이슈 번호를 작성했습니다
  • 기능이 정상적으로 작동합니다
  • 불필요한 코드를 제거했습니다

💬 추가 설명 or 리뷰 포인트 (선택)

컨벤션 놓친 부분은 특정 이모지 ✔️ 달아주시면 확인하겠습니다 ! (자꾸 놓치네요... 🙏 )

1. BKButton 기본 사용법

버튼 생성

let button = BKButton(style: .primary, size: .medium)
button.title = "로그인"

아이콘 설정

button.leftIcon = BKIcon.appleLogo.image
button.rightIcon = BKIcon.kakaoLogo.image

비활성화 상태

button.isDisabled = true

전체 너비 설정

button.isFullWidth = true

2. BKButtonConfiguration 활용

체이닝 방식 구성

let config = BKButtonConfiguration()
    .withStyle(.secondary)
    .withSize(.large)
    .withTitle("확인")
    .withLeftIcon(BKIcon.appleLogo.image)
    .withFullWidth(true)

let button = BKButton(configuration: config)

3. BKButtonGroup 사용법

수동 구성

let button1 = BKButton.primary(title: "버튼1", size: .small)
let button2 = BKButton.secondary(title: "버튼2", size: .small)

let group = BKButtonGroup(buttons: [button1, button2], layout: .horizontal)

기본 제공 메서드 사용

Two Button Group

let group = BKButtonGroup.twoButtonGroup(
    leftTitle: "취소",
    rightTitle: "확인",
    leftAction: { print("취소 tapped") },
    rightAction: { print("확인 tapped") }
)

Three Button Group

let group = BKButtonGroup.threeButtonGroup(
    leftTitle: "이전",
    centerTitle: "중간",
    rightTitle: "다음",
    leftAction: { print("이전 tapped") },
    centerAction: { print("중간 tapped") },
    rightAction: { print("다음 tapped") }
)

Single Full Button

let group = BKButtonGroup.singleFullButton(
    title: "다음",
    action: { print("다음 tapped") }
)

Vertical Button Group

let group = BKButtonGroup.verticalButtonGroup(
    buttons: [
        BKButton.primary(title: "A", size: .rounded),
        BKButton.secondary(title: "B", size: .rounded)
    ]
)

Summary by CodeRabbit

Summary by CodeRabbit

  • 신규 기능

    • 다양한 스타일, 크기, 아이콘, 상태를 지원하는 커스텀 버튼(BKButton) 컴포넌트가 추가되었습니다.
    • 버튼 그룹(BKButtonGroup) 컴포넌트가 도입되어 버튼을 수평, 수직, 풀-와이드 등 다양한 레이아웃으로 배치할 수 있습니다.
    • 버튼 데모 및 테스트를 위한 프리뷰 앱이 추가되어, 여러 버튼 스타일과 그룹을 직접 확인할 수 있습니다.
    • 커스텀 폰트와 런치 스크린이 적용되었습니다.
    • 버튼 구성 설정을 위한 BKButtonConfiguration 구조체와 버튼 상태 및 스타일 관련 열거형이 추가되었습니다.
    • UI 자동 갱신을 지원하는 SetNeeds 프로퍼티 래퍼가 도입되었습니다.
    • UIImage 리사이즈 및 UIColor 색상 비교 기능이 확장되었습니다.
  • 버그 수정

    • 없음
  • 기타

    • SnapKit 라이브러리 외부 의존성이 추가되었습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 9, 2025

"""

Walkthrough

이번 변경사항은 BKDesign 프로젝트에 공통 버튼 컴포넌트(BKButton)와 버튼 그룹(BKButtonGroup)을 새롭게 도입하고, 다양한 스타일, 상태, 크기, 색상 분기를 지원하는 UI 컴포넌트와 관련 데모 앱을 추가하는 내용입니다. SnapKit 등 외부 의존성도 추가되었습니다.

Changes

파일/경로 그룹 변경 요약
.../BKDesign/Sources/Components/Button/BKButton.swift
BKButtonConfiguration.swift
BKButtonGroup.swift
BKButtonProtocol.swift
BKButtonSize.swift
BKButtonState.swift
BKButtonStyle.swift
BKButton, BKButtonGroup 등 버튼 관련 주요 컴포넌트 및 설정, 스타일, 상태, 프로토콜, 사이즈 enum 등 신규 구현
.../BKDesign/Sources/Extensions/SetNeeds.swift
UIColor+.swift
UIImage+.swift
UIView 갱신용 property wrapper, UIColor/UIImage 비교 및 리사이즈 확장 메서드 추가
.../BKDesign/PreviewApp/Sources/AppDelegate.swift
SceneDelegate.swift
View/BKButtonGroupDemoViewController.swift
View/BKButtonTestViewController.swift
버튼 데모 앱의 AppDelegate, SceneDelegate, 데모 뷰컨트롤러 등 신규 추가
.../BKDesign/PreviewApp/Info.plist
Resources/LaunchScreen.storyboard
데모 앱 Info.plist 및 런치 스크린 스토리보드 신규 추가
.../BKDesign/Project.swift SnapKit 의존성 추가, BKDesignPreviewApp 타겟 신규 추가
.../BKDesign/Sources/Components/BKButton.swift 기존 빈 BKButton.swift 파일 삭제

Sequence Diagram(s)

sequenceDiagram
    participant User as 사용자
    participant VC as BKButtonGroupDemoViewController
    participant Group as BKButtonGroup
    participant Button as BKButton

    User->>VC: 앱 실행, 버튼 데모 화면 진입
    VC->>Group: 다양한 버튼 그룹 생성/설정
    Group->>Button: 버튼 인스턴스 생성 및 스타일/상태/크기 적용
    User->>Button: 버튼 탭(pressed)
    Button->>Button: 상태 변경(pressed/disabled 등) 및 UI 업데이트
    Button-->>User: 액션 실행 및 피드백
Loading

Assessment against linked issues

Objective Addressed Explanation
버튼 컴포넌트 개발 (#64)
enabled, disabled, pressed 상태 별로 디자인 구현 (#64)
radius, size에 따른 종류 분기 (#64)
color에 따른 종류 분기 (#64)

Poem

🐇
버튼이 깡충, 그룹도 척척
스타일과 크기, 색상도 번쩍!
누르면 눌림, 비활성도 척
데모 앱 속에서 토끼도 덩실
새 버튼 세상, 디자인 완성!
🥕
"""


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72b44fe and d828e9f.

📒 Files selected for processing (2)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Extensions/SetNeeds.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Projects/BKDesign/Sources/Extensions/SetNeeds.swift
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BOOK-114-feature/#64

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @coderabbitai 요약 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (5)
src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (1)

115-118: 레이아웃에 따라 content hugging priority 설정을 조건부로 적용하세요.

모든 버튼에 .required priority를 설정하고 있지만, fillEqually distribution에서는 이 설정이 무시됩니다. 레이아웃 타입에 따라 필요한 경우에만 설정하는 것이 좋습니다.

 buttons.forEach { button in
-    button.setContentHuggingPriority(.required, for: .horizontal)
+    if layout == .horizontal && stackView.distribution == .fillProportionally {
+        button.setContentHuggingPriority(.required, for: .horizontal)
+    }
     stackView.addArrangedSubview(button)
 }
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (4)

89-92: currentState 프로퍼티의 성능 최적화를 고려하세요.

currentState가 자주 호출되는데 매번 새 인스턴스를 생성합니다. 상태가 변경될 때만 업데이트하는 저장 프로퍼티로 변경하면 성능이 향상될 수 있습니다.

-private var currentState: BKButtonState {
-    return BKButtonState(isEnabled: isEnabled, isHighlighted: isHighlighted)
-}
+private var currentState: BKButtonState = .normal

 public override var isHighlighted: Bool {
     didSet {
+        currentState = BKButtonState(isEnabled: isEnabled, isHighlighted: isHighlighted)
         updateButtonState()
         animatePressedState()
     }
 }

 public override var isEnabled: Bool {
     didSet {
+        currentState = BKButtonState(isEnabled: isEnabled, isHighlighted: isHighlighted)
         updateButtonState()
     }
 }

252-261: 아이콘 리사이즈 성능을 최적화하세요.

매번 아이콘을 리사이즈하는 것은 성능에 영향을 줄 수 있습니다. 특히 동일한 아이콘을 여러 버튼에서 사용하는 경우 비효율적입니다.

이미지 캐싱을 고려하거나, 아이콘 설정 시 미리 리사이즈된 이미지를 제공하는 방법을 검토하세요:

// 캐시를 사용한 예시
private static var resizedImageCache = NSCache<NSString, UIImage>()

private func resizeImage(_ image: UIImage, to size: CGSize) -> UIImage? {
    let key = "\(image.hash)_\(size.width)x\(size.height)" as NSString
    if let cached = Self.resizedImageCache.object(forKey: key) {
        return cached
    }
    let resized = image.resize(to: size)
    if let resized = resized {
        Self.resizedImageCache.setObject(resized, forKey: key)
    }
    return resized
}

165-171: 아이콘 크기 제약조건 설정 코드가 중복됩니다.

setupIconViewsupdateIconSizes에서 동일한 제약조건을 설정/업데이트합니다. 초기화 시 updateIconSizes를 호출하면 중복을 제거할 수 있습니다.

 private func setupIconViews() {
     [leftIconView, rightIconView].forEach { iconView in
         iconView.contentMode = .scaleAspectFit
         iconView.isHidden = true
         iconView.isUserInteractionEnabled = false
         iconView.setContentHuggingPriority(.required, for: .horizontal)
         iconView.setContentCompressionResistancePriority(.required, for: .horizontal)
     }
-
-    leftIconView.snp.makeConstraints { make in
-        make.width.height.equalTo(size.iconSize.width)
-    }
-
-    rightIconView.snp.makeConstraints { make in
-        make.width.height.equalTo(size.iconSize.width)
-    }
 }

그리고 setupButton에서 updateIconSizes()를 호출하세요.


114-122: UIButton 기본 기능 비활성화를 더 명확하게 처리하세요.

빈 문자열 설정보다는 UIButton의 타입을 .custom으로 설정하고 필요한 속성만 비활성화하는 것이 더 명확합니다.

 // UIButton의 기본 요소들을 숨김
-setTitle("", for: .normal)
+setTitle(nil, for: .normal)
 setImage(nil, for: .normal)
+titleLabel?.isHidden = true
+imageView?.isHidden = true
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c25dee1 and f4d6d4e.

📒 Files selected for processing (18)
  • src/Projects/BKDesign/PreviewApp/Info.plist (1 hunks)
  • src/Projects/BKDesign/PreviewApp/Resources/LaunchScreen.storyboard (1 hunks)
  • src/Projects/BKDesign/PreviewApp/Sources/AppDelegate.swift (1 hunks)
  • src/Projects/BKDesign/PreviewApp/Sources/SceneDelegate.swift (1 hunks)
  • src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonGroupDemoViewController.swift (1 hunks)
  • src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (1 hunks)
  • src/Projects/BKDesign/Project.swift (2 hunks)
  • src/Projects/BKDesign/Sources/Components/BKButton.swift (0 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonProtocol.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonState.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Extensions/SetNeeds.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Extensions/UIColor+.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Extensions/UIImage+.swift (1 hunks)
💤 Files with no reviewable changes (1)
  • src/Projects/BKDesign/Sources/Components/BKButton.swift
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:38-48
Timestamp: 2025-07-08T17:17:40.046Z
Learning: doyeonk429는 BKDesign 프로젝트에서 다크모드 지원 코드를 미래를 위한 사전 준비 코드로 구현하고 있다. 현재 다크모드 디자인이 없어서 모든 다크모드 분기에서 라이트모드 색상을 반환하도록 의도적으로 구현했으며, 나중에 다크모드 디자인이 완성되면 해당 케이스만 구현하면 되는 구조로 설계했다.
src/Projects/BKDesign/Sources/Extensions/UIColor+.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/PreviewApp/Info.plist (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
src/Projects/BKDesign/PreviewApp/Resources/LaunchScreen.storyboard (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
src/Projects/BKDesign/Sources/Components/Button/BKButtonState.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (1)
Learnt from: clxxrlove
PR: YAPP-Github/Reed-iOS#56
File: src/Projects/BKPresentation/Sources/AuthFlow/ViewModel/LoginViewModel.swift:109-111
Timestamp: 2025-07-07T13:47:32.784Z
Learning: The LoginViewModel's authenticateWithToken case in src/Projects/BKPresentation/Sources/AuthFlow/ViewModel/LoginViewModel.swift is test code and not important for implementation according to the user.
src/Projects/BKDesign/Sources/Components/Button/BKButtonProtocol.swift (2)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/Project.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (2)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Resources/Assets.xcassets/chevron-right.imageset/Contents.json:1-26
Timestamp: 2025-07-08T17:15:59.793Z
Learning: In the BKDesign project, all image assets referenced in Contents.json files are properly included in the repository with the correct 1x, 2x, and 3x variants. The chevron-right icon and other design system icons are complete and ready for use.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1)
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.
🧬 Code Graph Analysis (5)
src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (1)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (3)
  • primary (336-343)
  • secondary (345-352)
  • tertiary (354-361)
src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonGroupDemoViewController.swift (2)
src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (4)
  • twoButtonGroup (127-145)
  • threeButtonGroup (161-186)
  • singleFullButton (147-158)
  • verticalButtonGroup (189-195)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)
  • primary (336-343)
src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (1)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)
  • primary (336-343)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (3)
src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1)
  • color (100-106)
src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift (1)
  • cornerRadius (101-110)
src/Projects/BKDesign/Sources/Extensions/UIImage+.swift (1)
  • resize (7-16)
src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (1)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (3)
  • secondary (345-352)
  • primary (336-343)
  • tertiary (354-361)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (29)
src/Projects/BKDesign/Sources/Extensions/UIColor+.swift (1)

104-110: 색상 비교 메서드가 올바르게 구현되었습니다.

CGColor의 __equalTo 메서드를 사용한 색상 비교는 정확하고 효율적입니다. 버튼 스타일의 색상 세트 비교에 활용되는 것으로 보이며, 메서드 시그니처와 구현이 Swift 관례를 잘 따르고 있습니다.

src/Projects/BKDesign/Sources/Extensions/UIImage+.swift (1)

1-17: 이미지 리사이징 메서드가 현대적이고 효율적으로 구현되었습니다.

UIGraphicsImageRenderer를 사용한 구현은 올바르며, preferred() 포맷을 사용하여 최적화된 렌더링을 제공합니다. 버튼 아이콘 크기 조정에 활용되는 유틸리티 메서드로 적절합니다.

src/Projects/BKDesign/PreviewApp/Info.plist (1)

1-68: PreviewApp의 Info.plist 구성이 올바릅니다.

표준 iOS 앱 구성 요소들이 모두 적절히 설정되어 있으며, SceneDelegate 아키텍처, 폰트 등록, 디바이스 제한 등이 데모 앱에 적합하게 구성되어 있습니다.

src/Projects/BKDesign/PreviewApp/Resources/LaunchScreen.storyboard (1)

1-30: 표준적인 런치 스크린 스토리보드가 올바르게 구성되었습니다.

시스템 배경색을 사용하고 안전 영역 레이아웃 가이드가 활성화된 표준적인 런치 스크린 구성입니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonProtocol.swift (1)

1-34: 버튼 프로토콜이 잘 설계되고 문서화되었습니다.

버튼 컴포넌트의 공통 인터페이스를 명확하게 정의하고 있으며, 각 속성에 대한 상세한 문서화가 제공되어 있습니다. AnyObject 제약과 get/set 속성들이 UI 컴포넌트에 적합하게 구성되어 있습니다.

src/Projects/BKDesign/Sources/Extensions/SetNeeds.swift (1)

6-54: 잘 구현된 property wrapper입니다!

UI 업데이트를 자동화하는 깔끔한 구현입니다. 값 변경 시 자동으로 setNeedsLayout() 또는 setNeedsDisplay()를 호출하여 UI를 업데이트하는 방식이 효과적입니다.

src/Projects/BKDesign/PreviewApp/Sources/SceneDelegate.swift (1)

6-23: 표준적인 SceneDelegate 구현입니다.

iOS 13+ 스타일의 씬 기반 앱 생명주기를 올바르게 구현했습니다. 윈도우 설정과 네비게이션 컨트롤러 초기화가 적절합니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonState.swift (1)

5-33: 버튼 상태 관리를 위한 깔끔한 enum 구현입니다.

세 가지 상태(normal, pressed, disabled)를 명확하게 정의하고, isEnabledisHighlighted 속성을 기반으로 한 편리한 초기화 메서드를 제공합니다. 로직이 올바르고 문서화도 잘 되어 있습니다.

src/Projects/BKDesign/PreviewApp/Sources/AppDelegate.swift (1)

5-23: 표준적인 AppDelegate 구현입니다.

iOS 13+ 스타일의 앱 생명주기를 올바르게 구현했습니다. 미니멀한 구현이지만 프리뷰 앱의 목적에 적절합니다.

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (1)

89-119: 독립적인 버튼 설정이 잘 구현되었습니다.

다양한 스타일과 크기의 버튼을 생성하고 레이아웃을 설정하는 로직이 깔끔합니다. 팩토리 메서드 사용과 SnapKit을 이용한 제약 조건 설정이 적절합니다.

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonGroupDemoViewController.swift (3)

1-17: 클래스 구조가 깔끔하게 잘 구성되어 있습니다.

데모 뷰 컨트롤러의 구조와 기본 설정이 적절하게 구현되어 있습니다.


34-79: 다양한 버튼 그룹 시나리오를 포괄적으로 다루고 있습니다.

각 버튼 그룹의 팩토리 메서드들을 효과적으로 시연하고 있으며, 섹션별로 잘 구분되어 있습니다. 특히 커스텀 구성부터 미리 정의된 그룹까지 다양한 사용 사례를 보여줍니다.


81-87: 헬퍼 메서드가 적절하게 구현되어 있습니다.

버튼 생성과 액션 설정을 간결하게 처리하는 좋은 패턴입니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift (4)

5-20: 문서화가 잘 되어 있고 케이스 정의가 명확합니다.

각 버튼 크기의 용도가 명확하게 정의되어 있고, 문서 주석도 적절합니다.


22-31: 높이 값이 적절하게 설정되어 있습니다.

크기별 높이 차이가 사용자 경험에 적합하게 설정되어 있습니다.


46-63: 폰트 설정에서 적절한 폴백 로직을 사용하고 있습니다.

BKTextStyle을 우선 사용하고 실패 시 시스템 폰트로 폴백하는 안전한 패턴입니다.


97-111: 동적 corner radius 계산이 잘 구현되어 있습니다.

특히 rounded 케이스에서 버튼 너비의 절반을 사용하는 로직이 적절합니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (3)

5-31: 구조체 설계가 잘 되어 있고 속성들이 적절합니다.

버튼 구성에 필요한 모든 속성들이 잘 정의되어 있고, 문서화도 깔끔합니다.


32-58: 초기화 메서드가 적절한 기본값과 함께 잘 구현되어 있습니다.

모든 파라미터에 합리적인 기본값이 설정되어 있어 사용하기 편리합니다.


60-110: 불변 수정자 메서드들이 체이닝 패턴을 잘 구현하고 있습니다.

각 메서드가 새로운 인스턴스를 반환하는 불변 패턴을 따르고 있어 안전하고 예측 가능한 API를 제공합니다.

src/Projects/BKDesign/Project.swift (2)

17-19: SnapKit 의존성 추가가 적절합니다.

버튼 컴포넌트들에서 레이아웃 제약조건을 위해 필요한 의존성입니다.


30-55: 미리보기 앱 타겟 설정이 잘 구성되어 있습니다.

번들 ID, 리소스 경로, 개발 언어 설정 등이 모두 적절하게 설정되어 있습니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (5)

5-21: 버튼 스타일 정의가 잘 구조화되어 있습니다.

primary, secondary, tertiary의 계층적 구조와 custom 옵션이 적절하게 설계되었습니다.


25-51: 배경색 설정이 시맨틱 컬러를 적절히 활용하고 있습니다.

각 스타일별로 일관된 색상 체계를 사용하고 있으며, 기존 학습 내용에 따라 다크 모드 대비 코드 구조가 잘 준비되어 있습니다.


56-82: 전경색 설정이 배경색과 일관성 있게 구현되어 있습니다.

각 스타일의 목적에 맞는 적절한 텍스트 색상이 설정되어 있습니다.


85-112: BKButtonColorSet 구조체가 상태별 색상 관리를 깔끔하게 처리하고 있습니다.

state 기반 색상 반환과 solid 생성자가 잘 구현되어 있습니다.


114-120: Equatable 구현이 적절한 색상 비교를 사용하고 있습니다.

UIColor+.swift 확장의 isEqual(to:) 메서드를 사용하여 올바른 색상 비교를 구현하고 있습니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (1)

136-142: UIAction 클로저에서 메모리 누수 주의가 필요합니다.

action 클로저가 self나 다른 객체를 캡처하는 경우 retain cycle이 발생할 수 있습니다. 사용 시 weak self 패턴 사용을 고려하세요.

클로저 메모리 관리에 대한 문서화나 사용 예제를 추가하는 것이 좋겠습니다.

src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)

1-376: 전체적으로 잘 구조화된 버튼 컴포넌트입니다!

코드가 깔끔하게 정리되어 있고, MARK 주석으로 섹션이 명확히 구분되어 가독성이 좋습니다. @SetNeeds 프로퍼티 래퍼를 활용한 UI 업데이트 관리도 효과적입니다.

Comment thread src/Projects/BKDesign/Sources/Extensions/SetNeeds.swift Outdated
Comment thread src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift Outdated
Comment thread src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift
Comment thread src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift
Copy link
Copy Markdown
Member

@clxxrlove clxxrlove left a comment

Choose a reason for hiding this comment

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

수고하셨어요..!
컨벤션 지적을 자주 하게 되는데 안 익숙하셔서 그럴 수 밖에 없다고 생각합니다. (원래 스타일이 있으니까..) 기분 나쁘게 생각하지는 말아주세요 !!!

Comment on lines +1 to +3
// Copyright © 2025 Booket. All rights reserved

import UIKit
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PreviewApp은 머지하기 전에 지우실거죠 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

엇 아뇨! 디자인시스템 테스트하는 용도로 남겨두려고 했습니다. 원래 모듈화했을 때, 각 모듈에 테스트앱 달아서 화면 테스트 빨리 해볼 수 있는 것도 장점이어서 이를 활용하면 좋을 것 같아요.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

확인했습니다 ~

import UIKit

@propertyWrapper
public struct SetNeeds<Value: Equatable> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

오 이거 괜찮네용.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

디자인시스템 잘 활용하기 위해서 고민을 좀 해봤습니다..(+리서치)

private weak var view: UIView?

// 초기화
init(wrappedValue: Value, _ needs: Need...) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

컨벤션 !

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

d828e9f 적용 완료

}

extension BKButtonColorSet: Equatable {
public static func == (lhs: BKButtonColorSet, rhs: BKButtonColorSet) -> Bool {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

컨벤션 !

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

d828e9f 적용 완료

@doyeonk429
Copy link
Copy Markdown
Member Author

수고하셨어요..! 컨벤션 지적을 자주 하게 되는데 안 익숙하셔서 그럴 수 밖에 없다고 생각합니다. (원래 스타일이 있으니까..) 기분 나쁘게 생각하지는 말아주세요 !!!

@clxxrlove 당연하죠 ! 기분 나쁘기보다는 컨벤션 집어주실 때 귀찮으실까봐 이모지만 달아둬도 제가 체크한다는 의미였어요 ㅎㅎ 😄

@doyeonk429 doyeonk429 requested a review from clxxrlove July 10, 2025 10:14
@clxxrlove clxxrlove merged commit c4b7b29 into develop Jul 10, 2025
2 checks passed
@clxxrlove clxxrlove deleted the BOOK-114-feature/#64 branch July 10, 2025 10:43
@coderabbitai coderabbitai Bot mentioned this pull request Jul 15, 2025
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOOK-114/feat] Button 컴포넌트 개발

2 participants