Skip to content

Conversation

@J0onYEong
Copy link
Collaborator

변경된 점

  • 라우터 중복 생성 방지
  • 모듈 의존성 생성 시점 연기

라우터 중복 생성 방지

뷰 리드로잉에 의해 View요청시 기존 구현은 빌더를 통해 새로운 Router를 생성하여 반환 했습니다.
비번한 리드로잉시 해당 방식은 문제를 야기할 수 있기에 생성된 라우터 인스턴스가 있어면 그것을 재활용하는 방법으로 개선했습니다.

모듈 의존성 생성 시점 연기

기존 구현의 경우 모듈의 빌더 인스턴스를 생성하는 시점에 모든 디팬던시를 @Injected프로퍼티를 통해 생성하였습니다.
실제 해당 모듈은 build함수 호출시 활용됨으로 생성시점과 사용시점이 어긋난다고 판단했습니다.
따라서 의존성 생성 시점을 build함수를 호출하는 시점으로 변경했습니다.

@J0onYEong J0onYEong requested a review from Copilot April 28, 2025 08:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR delays the creation of module dependencies until the build function is invoked and prevents duplicate router instances during view re-draws. Key changes include:

  • Replacing property-based dependency injection with inline resolution via DependencyInjector.shared.resolve() in builder classes.
  • Reusing existing router instances in TabBarRouter to avoid duplicate router creation.
  • Removing calls to dettach routers in favor of simplified router lifecycle management.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
Projects/Features/Setting/Feature/Sources/SettingBuilder.swift Updates dependency injection pattern to resolve dependencies at build time.
Projects/Features/Root/Feature/Sources/TabBar/TabBarRouter.swift Adjusts router creation to reuse existing instances and simplifies lifecycle management.
Projects/Features/CoinDetail/Feature/Sources/CoinDetailPageBuilder.swift Delays dependency injection until build time.
Projects/Features/AllMarketTicker/Feature/Sources/AllMarketTickerBuilder.swift Delays dependency injection until build time and updates dependency resolution.
Comments suppressed due to low confidence (1)

Projects/Features/Root/Feature/Sources/TabBar/TabBarRouter.swift:96

  • The removal of the router detachment call may lead to unintended retention of router instances. Please verify that the new lifecycle management properly handles router deallocation to avoid potential memory leaks.
if let allMarketTickerRouter { dettach(allMarketTickerRouter) }

@J0onYEong J0onYEong merged commit 3fb893b into main Apr 28, 2025
1 check passed
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.

2 participants