Conversation
Contributor
There was a problem hiding this comment.
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) }
Projects/Features/AllMarketTicker/Feature/Sources/AllMarketTickerBuilder.swift
Show resolved
Hide resolved
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.
변경된 점
라우터 중복 생성 방지
뷰 리드로잉에 의해 View요청시 기존 구현은 빌더를 통해 새로운 Router를 생성하여 반환 했습니다.
비번한 리드로잉시 해당 방식은 문제를 야기할 수 있기에 생성된 라우터 인스턴스가 있어면 그것을 재활용하는 방법으로 개선했습니다.
모듈 의존성 생성 시점 연기
기존 구현의 경우 모듈의 빌더 인스턴스를 생성하는 시점에 모든 디팬던시를
@Injected프로퍼티를 통해 생성하였습니다.실제 해당 모듈은
build함수 호출시 활용됨으로 생성시점과 사용시점이 어긋난다고 판단했습니다.따라서 의존성 생성 시점을
build함수를 호출하는 시점으로 변경했습니다.