feat: 버튼 컴포넌트 개발#68
Conversation
|
""" Walkthrough이번 변경사항은 BKDesign 프로젝트에 공통 버튼 컴포넌트(BKButton)와 버튼 그룹(BKButtonGroup)을 새롭게 도입하고, 다양한 스타일, 상태, 크기, 색상 분기를 지원하는 UI 컴포넌트와 관련 데모 앱을 추가하는 내용입니다. SnapKit 등 외부 의존성도 추가되었습니다. Changes
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: 액션 실행 및 피드백
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ 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)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (5)
src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift (1)
115-118: 레이아웃에 따라 content hugging priority 설정을 조건부로 적용하세요.모든 버튼에
.requiredpriority를 설정하고 있지만,fillEquallydistribution에서는 이 설정이 무시됩니다. 레이아웃 타입에 따라 필요한 경우에만 설정하는 것이 좋습니다.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: 아이콘 크기 제약조건 설정 코드가 중복됩니다.
setupIconViews와updateIconSizes에서 동일한 제약조건을 설정/업데이트합니다. 초기화 시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
📒 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)를 명확하게 정의하고,
isEnabled와isHighlighted속성을 기반으로 한 편리한 초기화 메서드를 제공합니다. 로직이 올바르고 문서화도 잘 되어 있습니다.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 업데이트 관리도 효과적입니다.
clxxrlove
left a comment
There was a problem hiding this comment.
수고하셨어요..!
컨벤션 지적을 자주 하게 되는데 안 익숙하셔서 그럴 수 밖에 없다고 생각합니다. (원래 스타일이 있으니까..) 기분 나쁘게 생각하지는 말아주세요 !!!
| // Copyright © 2025 Booket. All rights reserved | ||
|
|
||
| import UIKit |
There was a problem hiding this comment.
엇 아뇨! 디자인시스템 테스트하는 용도로 남겨두려고 했습니다. 원래 모듈화했을 때, 각 모듈에 테스트앱 달아서 화면 테스트 빨리 해볼 수 있는 것도 장점이어서 이를 활용하면 좋을 것 같아요.
| import UIKit | ||
|
|
||
| @propertyWrapper | ||
| public struct SetNeeds<Value: Equatable> { |
There was a problem hiding this comment.
디자인시스템 잘 활용하기 위해서 고민을 좀 해봤습니다..(+리서치)
| private weak var view: UIView? | ||
|
|
||
| // 초기화 | ||
| init(wrappedValue: Value, _ needs: Need...) { |
| } | ||
|
|
||
| extension BKButtonColorSet: Equatable { | ||
| public static func == (lhs: BKButtonColorSet, rhs: BKButtonColorSet) -> Bool { |
@clxxrlove 당연하죠 ! 기분 나쁘기보다는 컨벤션 집어주실 때 귀찮으실까봐 이모지만 달아둬도 제가 체크한다는 의미였어요 ㅎㅎ 😄 |
🔗 관련 이슈
📘 작업 유형
📙 작업 내역
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구현기타 작업
SetNeedsproperty wrapper 추가SwiftDoc) 일부 적용🧪 테스트 내역
🎨 스크린샷 또는 시연 영상 (선택)
✅ PR 체크리스트
💬 추가 설명 or 리뷰 포인트 (선택)
1. BKButton 기본 사용법
버튼 생성
아이콘 설정
비활성화 상태
전체 너비 설정
2. BKButtonConfiguration 활용
체이닝 방식 구성
3. BKButtonGroup 사용법
수동 구성
기본 제공 메서드 사용
Two Button Group
Three Button Group
Single Full Button
Vertical Button Group
Summary by CodeRabbit
Summary by CodeRabbit
신규 기능
버그 수정
기타