Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new design system module for the MLS project, including various UI components like buttons, alerts, input fields, and list views, along with necessary assets and utility extensions. My review highlights several areas for improvement: ensuring consistent resource loading using the design system's asset manager instead of direct image initialization, improving encapsulation in list components, fixing potential constraint issues in buttons, and correcting log levels for font registration.
|
|
||
| func makeButton(label: UILabel) -> UIButton { | ||
| let button = UIButton() | ||
| let icon = UIImageView(image: UIImage(named: "rightArrow")) |
There was a problem hiding this comment.
Swift Package 내의 리소스를 로드할 때는 Bundle.module을 명시해야 합니다. UIImage(named:)를 직접 사용하면 메인 번들에서 이미지를 찾으려 하므로 패키지 외부에서 사용 시 이미지를 로드하지 못할 수 있습니다. DesignSystemAsset.image(named:)를 사용하여 일관성을 유지하세요.
| let icon = UIImageView(image: UIImage(named: "rightArrow")) | |
| let icon = UIImageView(image: DesignSystemAsset.image(named: "rightArrow")) |
| // MARK: - Properties | ||
| private let iconView: UIImageView = { | ||
| let view = UIImageView() | ||
| view.image = UIImage(named: "error") |
There was a problem hiding this comment.
| // MARK: - SetUp | ||
| private extension FloatingActionButton { | ||
| func configureUI() { | ||
| setImage(UIImage(named: "fab"), for: .normal) |
There was a problem hiding this comment.
Swift Package 내의 리소스를 로드할 때는 Bundle.module을 명시해야 합니다. UIImage(named:)를 직접 사용하면 메인 번들에서 이미지를 찾으려 하므로 패키지 외부에서 사용 시 이미지를 로드하지 못할 수 있습니다. DesignSystemAsset.image(named:)를 사용하여 일관성을 유지하세요.
| setImage(UIImage(named: "fab"), for: .normal) | |
| setImage(DesignSystemAsset.image(named: "fab"), for: .normal) |
| // MARK: - Components | ||
| private let warningIconView: UIImageView = { | ||
| let view = UIImageView() | ||
| view.image = UIImage(named: "warning") |
There was a problem hiding this comment.
| // MARK: - Properties | ||
| public let iconView: UIImageView = { | ||
| let view = UIImageView() | ||
| view.image = UIImage(named: "edit")?.withRenderingMode(.alwaysTemplate) |
There was a problem hiding this comment.
Swift Package 내의 리소스를 로드할 때는 Bundle.module을 명시해야 합니다. UIImage(named:)를 직접 사용하면 메인 번들에서 이미지를 찾으려 하므로 패키지 외부에서 사용 시 이미지를 로드하지 못할 수 있습니다. DesignSystemAsset.image(named:)를 사용하여 일관성을 유지하세요.
| view.image = UIImage(named: "edit")?.withRenderingMode(.alwaysTemplate) | |
| view.image = DesignSystemAsset.image(named: "edit").withRenderingMode(.alwaysTemplate) |
| let imageView = view.subviews.compactMap { $0 as? UIImageView }.first | ||
| print("이미지 뷰 설정") | ||
| imageView?.image = index < images.count ? images[index] : nil | ||
| } |
There was a problem hiding this comment.
ItemImageView의 내부 subviews에 직접 접근하여 UIImageView를 찾는 방식은 캡슐화를 해치고 구조 변경 시 오류가 발생할 가능성이 높습니다. ItemImageView에 이미 정의된 setImage 메서드를 사용하는 것이 좋으며, 디버깅용 print 문은 삭제해야 합니다.
for (index, view) in imageViews.enumerated() {
let image = index < images.count ? images[index] : nil
view.setImage(image: image, backgroundColor: .neutral200)
}| snp.makeConstraints { make in | ||
| make.height.equalTo(style.height) | ||
| } |
There was a problem hiding this comment.
configureUI 메서드는 isEnabled 값이 변경될 때마다 호출되는데, 이때 snp.makeConstraints를 호출하면 중복된 제약 조건이 계속 추가됩니다. snp.remakeConstraints를 사용하여 기존 제약 조건을 대체하거나, 제약 조건 설정을 초기화 시점에 한 번만 수행하도록 수정해야 합니다.
| snp.makeConstraints { make in | |
| make.height.equalTo(style.height) | |
| } | |
| snp.remakeConstraints { make in | |
| make.height.equalTo(style.height) | |
| } |
|
|
||
| if let error = error { | ||
| os_log(.error, "Error registering font: \(error.takeUnretainedValue())") | ||
| } else { |
📌 이슈
✅ 작업 사항