Feat/#64 - 피의자 데이터 연동 (CaseListView, OnePageView), 이미지 데이터 저장 방식 변경 #74
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.
📝 Summary
피의자 데이터를 그동안 받아오지 않던 부분 (CaseListView, OnePageView) 연결을 진행했습니다.
그리고 이미지 데이터를 처리하던 방식을 변경했습니다.
🔨 What
1️⃣ CaseListView & OnePageView 피의자 데이터 연동
fetchCases()와fetchAllDataOfSpecificCase(for:)내부에서SuspectEntity → Case 모델 변환 시 피의자 관련 데이터 (name, profileImage) 를 함께 매핑하도록 수정함.
2️⃣ 이미지 데이터 저장 방식 리팩토링
기존 문제점: 이미지 데이터를 Base64 인코딩 문자열 형태로 CoreData에 직접 저장했음.
→ 이 방식은 코드가 단순하지만, 메모리 사용량이 많고 디스크 접근 속도가 느림.
개선점: FileManager 기반 BinaryData 접근
-> 이제 이미지는 FileManager를 통해 앱 Sandbox 내 전용 디렉터리(Documents/CaseImages/)에
UUID.jpg형태로 개별 파일로 저장되며, CoreData에는 단순히 파일 경로 (String) 만 저장함.이렇게 변경함으로써 얻는 장점은 다음과 같음:
3️⃣ DWEffect 전역 메서드 merge(_:) 추가
여러 개의 DWEffect를 병렬로 실행하기 위해 새로운 정적 메서드 추가했음.
이 메서드는 withTaskGroup을 활용해 전달된 모든 이펙트를 동시에 실행하고, 각각이 발생시키는 Action을 reducer로 다시 전파함.
2025-C6-M6-DreamWorms/SUSA24-iOS/SUSA24-iOS/Sources/Application/Architecture/DWEffect.swift
Lines 44 to 61 in 5088a81
즉, 아래와 코드와 같이 비동기 액션을 이제는 병렬로 처리할 수 있음:
이전에는 Effect가 한 번에 하나의 작업만 수행 가능했지만, 이제 병렬적으로 여러 비동기 동작을 실행할 수 있어 / 화면 진입 시 Case / Location / Image 데이터를 동시에 불러오는 구조가 가능해짐.
2025-C6-M6-DreamWorms/SUSA24-iOS/SUSA24-iOS/Sources/Presentation/OnePageScene/OnePageFeature.swift
Lines 63 to 69 in 5088a81
👀 Review Notes
merge(_:)부분 활용법 확인 !