Skip to content

Commit

Permalink
Feat: SignUpView DI Container 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
YuleGlycerine committed Oct 27, 2024
1 parent 880eeaf commit 8629a59
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
11 changes: 0 additions & 11 deletions Kabinett/Application/KabinettApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ struct KabinettApp: App {
// MARK: - Profile Flow
@StateObject private var profileViewModel: ProfileViewModel

// MARK: - SignUp Flow
@StateObject private var signUpViewModel: SignUpViewModel

// MARK: - Componets Flow
@StateObject private var imagePickerViewModel: ImagePickerViewModel
@StateObject private var customTabViewModel: CustomTabViewModel
Expand Down Expand Up @@ -120,13 +117,6 @@ struct KabinettApp: App {
)
)

// MARK: - SignUp ViewModel
_signUpViewModel = .init(
wrappedValue: SignUpViewModel(
signUpUseCase: signUpUseCase
)
)

// MARK: - Componets ViewModels
_imagePickerViewModel = .init(
wrappedValue: ImagePickerViewModel(
Expand Down Expand Up @@ -174,7 +164,6 @@ struct KabinettApp: App {
.environmentObject(letterBoxDetailViewModel)
.environmentObject(calendarViewModel)
.environmentObject(profileViewModel)
.environmentObject(signUpViewModel)
.environmentObject(imagePickerViewModel)
.environmentObject(customTabViewModel)
.environmentObject(userSelectionViewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct SignUpKabinettNumberSelectView: View {
@EnvironmentObject var viewModel: SignUpViewModel
@ObservedObject var viewModel: SignUpViewModel
@Environment(\.dismiss) var dismiss
let horizontalPadding: CGFloat = UIScreen.main.bounds.width * 0.06

Expand Down
4 changes: 2 additions & 2 deletions Kabinett/Presentation/View/SignUp/SignUpNameInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct SignUpNameInputView: View {
@EnvironmentObject var viewModel: SignUpViewModel
@ObservedObject var viewModel: SignUpViewModel
@State private var shouldNavigate = false
let horizontalPadding: CGFloat = UIScreen.main.bounds.width * 0.06

Expand Down Expand Up @@ -51,7 +51,7 @@ struct SignUpNameInputView: View {
.keyboardType(.alphabet)
.submitLabel(.done)
.navigationDestination(isPresented: $shouldNavigate) {
SignUpKabinettNumberSelectView()
SignUpKabinettNumberSelectView(viewModel: viewModel)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
Expand Down
12 changes: 10 additions & 2 deletions Kabinett/Presentation/View/SignUp/SignUpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ import SwiftUI
import AuthenticationServices

struct SignUpView: View {
@EnvironmentObject private var viewModel: SignUpViewModel
@StateObject private var viewModel: SignUpViewModel
let horizontalPadding: CGFloat = UIScreen.main.bounds.width * 0.06

init() {
@Injected(SignUpUseCaseKey.self)
var signUpUseCase: SignUpUseCase

self._viewModel = StateObject(
wrappedValue: SignUpViewModel(signUpUseCase: signUpUseCase))
}

var body: some View {
ZStack {
Color.background.ignoresSafeArea(.all)
Expand Down Expand Up @@ -55,7 +63,7 @@ struct SignUpView: View {
viewModel.isLoading ? LoadingView() : nil
)
.navigationDestination(isPresented: $viewModel.showSignUpFlow) {
SignUpNameInputView()
SignUpNameInputView(viewModel: viewModel)
}
.alert(
"오류",
Expand Down

0 comments on commit 8629a59

Please sign in to comment.