We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When a TextField is focused, SwiftUI initializes the signUpView every time
TextField
signUpView
An example is below
struct SignUpView<SVM: SignUpVM>: View { @EnvironmentObject private var signUpViewModel: SVM @State private var idInput: String = "" var body: some View { ScrollView { VStack(spacing: 25) { //MARK: - Default Input IdInputView<SVM>(idInput: $idInput) .environmentObject(signUpViewModel) } } } } struct IdInputView<SVM: SignUpVM>: View { @EnvironmentObject private var signUpViewModel: SVM @Binding private var idInput: String var body: some View { VStack { SignUpInputView(text: $idInput, inputState: Binding( get: { self.signUpViewModel.defaultStates["id"] ?? .isInitial }, set: { newValue in self.signUpViewModel.defaultStates["id"] = newValue } ), header: "아이디", placeholder: "학번 또는 교직원 번호를 입력해 주세요", keyboardType: .numberPad) } } } struct SignUpInputView: View { @Binding private var text: String @Binding private var inputState: InputState var body: some View { VStack { HStack { Text(header).bold().font(.subheadline).foregroundColor(colorScheme == .light ? .black : .white) Spacer() } .offset(x: 16) RoundedRectangle(cornerRadius: 30) .fill(CustomColor.getSignUpInputGray(colorScheme)) .frame(height: UIScreen.main.bounds.width * 0.13) .overlay { switch style { case .normal: TextField(placeholder, text: $text) .keyboardType(keyboardType) .autocorrectionDisabled() .padding()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description(Problem)
When a
TextField
is focused, SwiftUI initializes thesignUpView
every timeCode
An example is below
The text was updated successfully, but these errors were encountered: