diff --git a/feature/search/src/main/java/com/record/search/Exhibition.kt b/feature/search/src/main/java/com/record/search/ExhibitionData.kt similarity index 83% rename from feature/search/src/main/java/com/record/search/Exhibition.kt rename to feature/search/src/main/java/com/record/search/ExhibitionData.kt index 525af893..567c4261 100644 --- a/feature/search/src/main/java/com/record/search/Exhibition.kt +++ b/feature/search/src/main/java/com/record/search/ExhibitionData.kt @@ -1,6 +1,6 @@ package com.record.search -data class Exhibition( +data class ExhibitionData( val exhibitionName: String, val location: String, val venue: String, diff --git a/feature/search/src/main/java/com/record/search/SearchScreen.kt b/feature/search/src/main/java/com/record/search/SearchScreen.kt index 7d352424..eae541cf 100644 --- a/feature/search/src/main/java/com/record/search/SearchScreen.kt +++ b/feature/search/src/main/java/com/record/search/SearchScreen.kt @@ -56,7 +56,7 @@ fun SearchScreen( modifier: Modifier, query: String, onQueryChange: (String) -> Unit, - items: List, + items: List, ) { val keyboardController = LocalSoftwareKeyboardController.current diff --git a/feature/search/src/main/java/com/record/search/SearchState.kt b/feature/search/src/main/java/com/record/search/SearchState.kt index 581ff131..56df46a4 100644 --- a/feature/search/src/main/java/com/record/search/SearchState.kt +++ b/feature/search/src/main/java/com/record/search/SearchState.kt @@ -2,10 +2,12 @@ package com.record.search import com.record.ui.base.SideEffect import com.record.ui.base.UiState +import kotlinx.collections.immutable.ImmutableList +import kotlinx.collections.immutable.toImmutableList data class SearchState( val query: String = "", - val filteredItems: List = emptyList(), + val filteredItems: ImmutableList = emptyList().toImmutableList(), ) : UiState sealed interface SearchSideEffect : SideEffect diff --git a/feature/search/src/main/java/com/record/search/SearchViewModel.kt b/feature/search/src/main/java/com/record/search/SearchViewModel.kt index 55ed80ab..ac661dfc 100644 --- a/feature/search/src/main/java/com/record/search/SearchViewModel.kt +++ b/feature/search/src/main/java/com/record/search/SearchViewModel.kt @@ -2,16 +2,17 @@ package com.record.search import androidx.lifecycle.viewModelScope import com.record.ui.base.BaseViewModel +import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.launch class SearchViewModel : BaseViewModel( initialState = SearchState(), ) { private val items = listOf( - Exhibition("국립현대미술관", "서울 종로구", "전시회장", listOf("미술전시회1", "전시회2", "전시회3")), - Exhibition("국으로 시작하는 단어", "서울 종로구", "전시회장", listOf("미술", "현대미술")), - Exhibition("서울 예술의 전당", "서울 서초구", "전시회장", listOf("음악")), - Exhibition("D Museum", "서울 용산구", "미술관", listOf("사진", "디자인")), + ExhibitionData("국립현대미술관", "서울 종로구", "전시회장", listOf("미술전시회1", "전시회2", "전시회3")), + ExhibitionData("국으로 시작하는 단어", "서울 종로구", "전시회장", listOf("미술", "현대미술")), + ExhibitionData("서울 예술의 전당", "서울 서초구", "전시회장", listOf("음악")), + ExhibitionData("D Museum", "서울 용산구", "미술관", listOf("사진", "디자인")), ) fun onQueryChanged(newQuery: String) { @@ -33,7 +34,7 @@ class SearchViewModel : BaseViewModel( } } intent { - copy(filteredItems = result) + copy(filteredItems = result.toImmutableList()) } } }