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

[Feature23] hilt 적용 #24

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

[Feature23] hilt 적용 #24

wants to merge 3 commits into from

Conversation

yujung5873
Copy link
Collaborator

#️⃣연관된 이슈

#23

📝작업 내용

Hilt를 사용하여 의존성 주입을 적용하고 코드의 유지보수성을 개선하였습니다.
Hilt는 Android 공식 DI 솔루션으로 Dagger의 성능을 유지하면서 설정이 간편하고 Jetpack과 완벽히 연동가능 해 Hilt로 선택하였습니다.

  1. Viewmodel 의존성 주입
    @HiltViewModel을 추가하여 MainViewmodel을 Hilt에서 관리하도록 변경
    UnsplashRepository를 생성자 주입하여 종송석 정의

  2. Repository 의존성 주입
    UnsplashRepository@Inject를 추가하여 Hilt가 자동으로 관리하도록 설정
    API통신을 위한 UnsplashApiService를 생성자 주입

  3. Retrofit 의존성 주입
    @Provides@Singleton을 사용하여 RetrofitUnsplashApiService를 DI 컨테이너에서 관리하도록 설정
    API 호출 시 객체를 매번 생성하지 않고, 하나의 인스턴스를 공유하도록 개선

참고 내용

Hilt android developers

@yujung5873 yujung5873 requested a review from f-lab-tony February 6, 2025 06:16
@yujung5873 yujung5873 self-assigned this Feb 6, 2025
Copy link

sonarqubecloud bot commented Feb 6, 2025

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