-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Home] Mock JSON으로 제품 리스트 가져오는 흐름 구현 #29
Merged
Merged
Conversation
This file contains 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
- SplashView is now displayed for 1 second before transitioning to HomeView. - Injected HomeViewModel into HomeView as an environmentObject.
- Switched from `Text(verbatim:)` to `Text(_:)` initializer
This reverts commit f418abb.
eung7
approved these changes
Feb 2, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의존성 주입에 많은 신경을 써서 구현하신 느낌을 받았습니다.
Flow를 따라가면서 이해하다보니, 저도 덕분에 많은 공부가 되었네요.
수고하셨습니다 ! ! 🤩
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.
Screenshots 📸
고민, 과정, 근거 💬
Entity를 모듈로 나누었습니다. APIService세부 모듈에 Entity가 존재하게 된다면, 다른 모듈에서 Entity를 참조할 수 없기 때문입니다(은근 공유하는 Entity 모델이 많아보이더라고요).
HomeViewModel을 이용하여 제품 리스트를 보여주어야 합니다.
그래서 HomeViewModel이 Network처리를 담당하는 Service를 갖도록 구현했고, 홈 화면에서 동작할 HomeService를 추가했습니다.
HomeService는 URLSession을 주입받기에, URLSession을 넣어줘야 합니다. 하지만 현재 API가 구현되어있지 않아
URLProtocol
을 이용하여 Mock data를 가져오도록 처리해두었습니다. 나중에 API가 개발되면, URLSession.configuration만 수정하면 됩니다.HomeService는 루트에서 주입받도록 Dependency를 설정해주었습니다.
References 📋