Conversation
There was a problem hiding this comment.
🤖 AI 코드 리뷰 - 아키텍처 관점
이 PR은 도메인 모델(Place, Route, RouteStep, TransportType 등)을 View 레이어에서 직접 사용하던 구조를 Presentation Model(PlaceInfo, RouteItem, RouteStepItem, AppointmentRouteParticipant 등)로 분리하는 리팩터링이다. ViewModel이 도메인 원본을 내부에 유지하고 Presentation Model로 변환한 값만 Published로 노출하는 방향은 계층 분리 측면에서 올바르다. 다만 PlaceInfo와 RouteStepItem이 UIKit(UIColor)을 직접 import하여 UI 프레임워크에 의존하게 된 점은 Presentation Model의 테스트 가능성을 저해하며, 동일한 포맷팅 로직(formatDuration)이 RouteStepItem에 static으로 존재하면서 RouteItem이 이를 참조하는 구조는 RouteItem이 RouteStepItem의 내부 구현에 결합되는 문제를 만든다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA
📝 작업 내용
📌 요약
🔍 상세
Presentation 모델 변환 패턴 통일
기존에는 일부 ViewModel이 Domain 타입(
Place,Route,RouteStep)을@Published로 직접 노출하고 있어서, View가 Domain 계층에 의존하고 있었습니다.모든 ViewModel에 동일한 패턴을 적용했습니다:
@Published로는 Presentation 타입만 노출 (PlaceInfo,RouteItem등)신규 모델 추가
RouteItem과RouteStepItem을 추가하여Route/RouteStep의 표시용 변환을 담당하도록 했습니다.기존에
RouteCard에 있던formatDuration로직을RouteStepItem으로 이동하여 중복을 제거했습니다.PlaceInfo 구조 변경
기존
PlaceInfo는tag: PlaceType으로 Domain enum을 직접 들고 있었습니다.tagTitle: String,tagColor: UIColor로 변경하여 View가 Domain enum에 의존하지 않도록 했습니다.PlaceTagCapsule도init(_ placeType:)대신init(title:color:)만 사용하도록 변경했습니다.💬 리뷰 노트
Presentation 모델을 두는 이유
Domain 모델은 비즈니스 로직을 위한 구조이고, View는 표시를 위한 가공된 데이터가 필요합니다.
이 둘을 분리하면:
적용한 규칙
init(domain:)에서 수행PlaceType,TransportTypeenum은 래핑하지 않되, Presentation 모델의 프로퍼티에는 display 값으로 풀어서 저장Presentation model 네이밍 컨벤션
~Info~Item~State/~OptionMainActor isolation 경고 해결
커밋
Domain→Presentation 변환 과정에서
.map(PlaceInfo.init)같은 함수 참조 문법을 사용했는데, 이 프로젝트의 default-isolation=MainActor 설정과 맞물려Call to main actor-isolated initializer in a synchronous nonisolated context경고가 발생했습니다.함수 참조는 독립적인 함수 값으로 취급되어 actor context를 잃지만, 클로저는 둘러싼 코드의 actor context를 상속합니다.
.map { PlaceInfo(place: $0) }형태로 변경하여 해결했습니다.구조 정리 문서
도메인 모델과 프레젠테이션 모델 각 구조에 대한 다이어그램/문서 작업을 진행 중입니다.
완성 후 JIRA 문서에 추가할 예정입니다!