Skip to content

[refactor] ViewControllerFactory 구현부 DIContainer로부터 분리#154

Open
H0sungKim wants to merge 3 commits intodevelopfrom
refactor/#153-di
Open

[refactor] ViewControllerFactory 구현부 DIContainer로부터 분리#154
H0sungKim wants to merge 3 commits intodevelopfrom
refactor/#153-di

Conversation

@H0sungKim
Copy link
Contributor

@H0sungKim H0sungKim commented Jan 30, 2026

🎯 Related Issues

📋 Description

  • DIContainer가 너무 뚱뚱해지는 것 같아서 ViewControllerFactory Protocol 기본 구현을 만들어서 따로 뺐어요. DIContainer 다이어트 성공 ㅎㅎ!!!!
  • APIProvider, Service, Repository, UseCase, ViewModel, ViewController를 모두 Factory로 만들고, ServiceFactory가 APIProviderFactory를 채택하고 또 RepositoryFactory가 ServiceFactory를 채택하고... 이걸 쭉 반복해서 APIProvider <- Service <-Repository <- UseCase <- ViewModel 와 같은 구조로 만듭니다. 그러면 마지막에 DIContainer가 ViewModelFactory와 ViewControllerFactory만 채택하고 조립해서 구현된 ViewControllerFactory를 Presentation계층에서 사용할 수 있습니다.

💬 To Reviewers

  • 내일 보장~~ ㅎㅎㅎ!!!

@H0sungKim H0sungKim linked an issue Jan 30, 2026 that may be closed by this pull request
1 task
@H0sungKim H0sungKim requested review from rosejinse and soeun11 and removed request for rosejinse January 30, 2026 15:17
@H0sungKim H0sungKim self-assigned this Jan 30, 2026
Copy link
Contributor Author

Choose a reason for hiding this comment

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

extension ProtocolA: ProtocolB가 안되더라고요~~!!
그래서 꼼수로 where Self: AddContentSelectViewModelFactory & ViewControllerFactory
AddContentSelectViewModelFactory랑 ViewControllerFactory 채택하고 있는 애에서 AddContentSelectViewControllerFactory를 채택하면 해당 기본 구현을 제공해라~ 라고 만들었습니다.

이러면 이제 DIContainer: ViewControllerFactory & AddContentSelectViewModelFactory이렇게 채택만 해주면 makeAddContentSelectViewController()함수를 사용할 수 있어여~~!!!

Copy link
Contributor

Choose a reason for hiding this comment

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

상당히 고능코드군요 .. where self 배워갑니다 👍

Copy link
Contributor

@soeun11 soeun11 left a comment

Choose a reason for hiding this comment

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

확실히 DIContainer랑 viewcontrollerFactory가 깔끔해지긴했네요 .. 이해잘한진모르겠는데 ^-^ 노력해볼게요

Copy link
Contributor

Choose a reason for hiding this comment

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

상당히 고능코드군요 .. where self 배워갑니다 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] DI 리팩토링

2 participants