diff --git a/app/src/main/java/com/sopt/now/compose/screen/auth/signup/SignUpViewModelFactory.kt b/app/src/main/java/com/sopt/now/compose/screen/auth/signup/SignUpViewModelFactory.kt new file mode 100644 index 0000000..535bd69 --- /dev/null +++ b/app/src/main/java/com/sopt/now/compose/screen/auth/signup/SignUpViewModelFactory.kt @@ -0,0 +1,15 @@ +package com.sopt.now.compose.screen.auth.signup + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.sopt.now.compose.repository.SignUpRepository + +class SignUpViewModelFactory(private val signUpRepository: SignUpRepository) : ViewModelProvider.Factory { + override fun create(modelClass: Class): T { + if (modelClass.isAssignableFrom(SignUpViewModel::class.java)) { + @Suppress("UNCHECKED_CAST") + return SignUpViewModel(signUpRepository) as T + } + throw IllegalArgumentException("알 수 없는 ViewModel 클래스") + } +} \ No newline at end of file diff --git a/app/src/main/java/com/sopt/now/compose/screen/main/mypage/MyPageViewModelFactory.kt b/app/src/main/java/com/sopt/now/compose/screen/main/mypage/MyPageViewModelFactory.kt new file mode 100644 index 0000000..709afc8 --- /dev/null +++ b/app/src/main/java/com/sopt/now/compose/screen/main/mypage/MyPageViewModelFactory.kt @@ -0,0 +1,15 @@ +package com.sopt.now.compose.screen.main.mypage + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.sopt.now.compose.repository.UserInfoRepository + +class MyPageViewModelFactory(private val userInfoRepository: UserInfoRepository) : ViewModelProvider.Factory { + override fun create(modelClass: Class): T { + if (modelClass.isAssignableFrom(MyPageViewModel::class.java)) { + @Suppress("UNCHECKED_CAST") + return MyPageViewModel(userInfoRepository) as T + } + throw IllegalArgumentException("알 수 없는 ViewModel 클래스") + } +} \ No newline at end of file