Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDLE] 모듈 구조 리팩토링 #79

Merged
merged 10 commits into from
Sep 30, 2024
Merged

[IDLE] 모듈 구조 리팩토링 #79

merged 10 commits into from
Sep 30, 2024

Conversation

J0onYEong
Copy link
Contributor

변경된 점

  • 도메인/데이터 계층 모듈구조 변경
  • 코디네이터간 의존성 감축

도메인/데이터 계층 모듈구조 변경

기존의 모듈 구조의 경우 인터페이스, 모델, 구현체 모듈이 각각존재했습니다.
모듈분리를 통한 근거가 부족하고 모듈간 의존 관계가 복잡해지는 결과를 초례했습니다. 따라서 해당 모듈들을 하나의 모듈로 통합시켰습니다.

코디네이터간 의존성 감축

기존의 코드의 경우 의존성 주입을 위해 상위 코드네이터가 하위 코디네이터의 의존성 객체를 보유해야 했습니다.
해당 구조는 코디네이터간 커플링을 증가시켜 네비게이션 구조에까지 종속성을 만들어 버리는 결과를 초례했습니다.
이 문제를 해결하고자, 의존성주입을 싱글톤 객체를 사용하는 방식으로 변경했습니다.
이를 위해 Core모듈을 만들어 모든 모듈이 해당 모듈에 접근가능하게한 후, 해당 모듈에 싱글톤 객체를 정의하여 접근가능하도록 코디네이터간 계층관계없이 의존성을 주입받을 수 있도록 설정했습니다.

스크린샷 2024-09-30 오후 3 04 22

Injected프로퍼티 랩퍼를 사용하여, 싱글톤객체에 접근하지 않고 주입이 가능하도록 구현하였습니다.

@propertyWrapper
public class Injected<T> {
    
    public let wrappedValue: T
    
    public init() {
        self.wrappedValue = DependencyInjector.shared.resolve()
    }
}

@J0onYEong J0onYEong merged commit 7cb99ec into develop Sep 30, 2024
1 check passed
@J0onYEong J0onYEong deleted the refactor/module_tree branch September 30, 2024 06:10
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.

1 participant