Skip to content

[#839] 의존성 주입 라이브러리인 Cradle을 적용한다 - #840

Merged
opficdev merged 19 commits into
developfrom
refactor/#839
Sep 7, 2026
Merged

[#839] 의존성 주입 라이브러리인 Cradle을 적용한다#840
opficdev merged 19 commits into
developfrom
refactor/#839

Conversation

@opficdev

@opficdev opficdev commented Sep 7, 2026

Copy link
Copy Markdown
Owner

🔗 연관된 이슈

🎯 의도

AppDIContainerAssembler 기반 런타임 의존성 등록·조회 구조를 Cradle 1.2.0 기반 graph 구성으로 전환하는 작업

기존 구현 initializer의 입력 형태와 객체 동일성을 유지하면서 모듈별 생성 책임과 App의 생명주기 조립 책임을 분리하기 위한 구조 개편

📝 작업 내용

📌 요약

  • Cradle 1.2.0 package 연결
  • Infra, Persistence, Widget, Data, Domain의 provider graph 구성
  • 기능별 GraphSetAppGraph.shared 기반 앱 graph 조립
  • Firebase 초기화와 lifecycle handler 활성화 순서 유지
  • TCA DependencyValues를 통한 Presentation 의존성 연결
  • 소셜 로그인 구현별 protocol 분리
  • 기존 DIContainer와 계층별 Assembler 제거

🔍 상세

모듈별 provider graph 구성

  • 기존 Assembler가 사용하던 initializer의 의존성 타입, 레이블, 순서를 유지한 provider 구성
  • Persistence store, Infra service, Data Repository, Domain UseCase, Widget 동기화 객체의 소유 target별 graph 분리
  • 일반 객체는 기본 @Provide로 생성하고 실제 지연 근거가 있는 monitor·subscription·handler만 @Provide(.lazy)로 구성
  • AppGraph@DependencyGraph(.shared)를 사용하고 하위 module graph는 App graph 수명 안에서 보관하는 구조

App graph 조립

  • PersistenceGraphSet, InfraGraphSet, WidgetGraphSet과 기능별 Repository·UseCase GraphSet 구성
  • AppGraph에서 14개 GraphSet만 등록하고 service·Repository·UseCase 직접 등록 제외
  • Firebase 구성 이후 Firebase 기반 service graph가 생성되는 순서 유지
  • network connectivity와 auth session의 monitor·subscription 생성 지연 유지
  • Widget event bus, snapshot updater, session provider를 연결된 기능에서 동일 인스턴스로 공유

App lifecycle 전환

  • FCMTokenSyncHandlerGraph, UserTimeZoneSyncHandlerGraph, PushNotificationOpenHandlerGraph 구성
  • lifecycle handler 활성화 순서 유지
    1. FCMTokenSyncHandler
    2. UserTimeZoneSyncHandler
    3. WidgetSyncEventHandler
    4. WidgetSessionSyncHandler
  • PushMessagingService.setDelegate, push open 처리, background Widget 동기화를 같은 AppGraph.shared 출력으로 연결

Presentation 연결

  • DevLogApp.init에서 prepareDependencies를 한 번 호출해 Cradle graph의 UseCase를 기존 TCA DependencyValues에 연결
  • Root, Login, Main, 공통 Todo, Home, Search, Today, Notification, Profile, Settings, Account 단위의 의존성 준비 경계 구성
  • Presentation target의 Cradle 직접 의존 없이 기존 @Dependency, withDependencies, TestStore 흐름 유지
  • Coordinator와 View의 DIContainer, diContainer, container.resolve 제거

인증 provider 분리

  • AppleAuthenticationService, GithubAuthenticationService, GoogleAuthenticationService protocol 구성
  • 인증 구현과 AuthenticationRepositoryImpl, AuthDataRepositoryImpl의 역할별 타입 연결
  • 문자열 이름 기반 인증 provider 등록·조회 제거

기존 DI 제거

  • AppDIContainer, DIContainer, DIContainerKey, DependencyName, DependencyScope 제거
  • Assembler protocol과 App·Persistence·Infra·Widget·Data·Domain의 *Assembler.swift 제거
  • 아키텍처 문서와 프로젝트 구조 설명을 Cradle graph 조립 기준으로 갱신

검증

  • Tuist 프로젝트 생성 성공
  • App scheme build 성공
  • App 및 관련 Presentation scheme build-for-testing 성공
  • 변경 Swift 파일 SwiftLint 통과
  • Presentation의 container.resolve, DIContainer, diContainer, Cradle import 잔존 없음
  • 전체 production source의 legacy DI 등록·조회 참조 잔존 없음
  • AppGraph provider와 lifecycle·Widget 객체 동일성 정적 검토 통과
  • git diff --check 통과
  • 최종 legacy DI 파일 제거 후 전체 App build 재실행 미수행

📸 영상 / 이미지 (Optional)

해당 없음

@opficdev opficdev self-assigned this Sep 7, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T11:01:41.934227Z 6aa3242 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6aa32426dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Application/App/Sources/App/Graph/AppGraph.swift
Comment thread .agents/roles.md
Comment thread .agents/rules/architecture.md
@opficdev
opficdev merged commit 0ef2f00 into develop Sep 7, 2026
9 checks passed
@opficdev
opficdev deleted the refactor/#839 branch September 7, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

의존성 주입 라이브러리인 Cradle을 적용한다

1 participant