domain2 [Android] Clean Architecture With Pokedex (feat. Jetpack Compose, Hilt) - 4 이번 포스팅은 Presentation 레이어를 구현한다. 즉, presentation 모듈을 구현하게 된다. presentation 레이어는 앱의 UI, UI에 보여줄 데이터를 획득하는 기능을 담당한다. UI를 그리기 위해 Compose를 활용할 것이며, UI의 데이터, 즉 상태를 관리하는 기능은 ViewModel을 활용할 것이다. 먼저 포켓몬 리스트 데이터를 담당하는 ViewModel을 구현해보자. @HiltViewModel class PokemonListViewModel @Inject constructor( getPokemonListUseCase: GetPokemonListUseCase ) : ViewModel() { val pokemonList = getPokemonListUseCase .invok.. 2023. 1. 1. [Android] Clean Architecture With Pokedex (feat. Jetpack Compose, Hilt) - 2 이번 포스팅은 Clean architecture의 가장 안쪽 레이어인 Domain 레이어를 구현할 것이다. 즉, 이전 포스팅에서 생성한 domain 모듈을 구현한다. 먼저 entity를 구현해보도록 하겠다. 포켓몬 도감은 포켓몬들을 리스트업하고 상세한 내용을 볼 수 있는 기능을 갖는다. 따라서 포켓몬 리스트를 구성할 Entity와 포켓몬 상세를 표현할 Entity가 필요하다. 아래와 같은 Entity 코드를 작성한다. data class PokemonEntity( val id: Int, val name: String, val imageUrl: String ) data class PokemonDetailEntity( val id: Int, val name: String, val imageUrl: Strin.. 2022. 7. 9. 이전 1 다음 반응형