Skip to content

Commit 1d307ae

Browse files
committed
✨ 뷰페이저의 프레그먼트들이 하나의 뷰모델을 공유하도록 변경
1 parent ee69a83 commit 1d307ae

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

presentation/src/main/java/com/whyranoid/presentation/community/CommunityItemFragment.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.os.Build
44
import android.os.Bundle
55
import android.view.View
66
import androidx.core.view.isVisible
7-
import androidx.fragment.app.viewModels
7+
import androidx.fragment.app.activityViewModels
88
import androidx.lifecycle.lifecycleScope
99
import androidx.navigation.fragment.findNavController
1010
import com.whyranoid.presentation.R
@@ -18,7 +18,7 @@ import kotlinx.coroutines.launch
1818
internal class CommunityItemFragment :
1919
BaseFragment<FragmentCommunityItemBinding>(R.layout.fragment_community_item) {
2020

21-
private val viewModel: CommunityViewModel by viewModels()
21+
private val viewModel: CommunityViewModel by activityViewModels()
2222

2323
private val category by lazy {
2424
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
@@ -86,7 +86,6 @@ internal class CommunityItemFragment :
8686
}
8787
}
8888

89-
// TODO 카테고리 별 다른 아이템 처리
9089
private fun setMyGroupAdapter() {
9190
val myGroupAdapter = MyGroupAdapter { groupInfo ->
9291
viewModel.onCategoryItemClicked(groupInfo)

0 commit comments

Comments
 (0)