@@ -50,34 +50,35 @@ final class SignUpViewModel {
5050
5151 return Output ( buttonEnabled: buttonEnabled, signUpResult: signUpResult)
5252 }
53+ }
5354
55+ private extension SignUpViewModel {
5456 func checkEmpty( _ strArray: [ String ] ) -> Bool {
5557 return !strArray. reduce ( false ) { $0 || $1. isEmpty }
5658 }
57-
59+
5860 func checkSame( str1: String , str2: String ) -> Bool {
5961 return str1 == str2
6062 }
61-
63+
6264 func checkEmail( str: String ) -> Bool {
63-
65+
6466 guard let index = str. firstIndex ( of: " @ " ) else { return false }
6567 let pos = str. distance ( from: str. startIndex, to: index)
6668 return 0 < pos && pos < str. count - 1
6769 }
68-
70+
6971 func checkPasswordCount( str: String ) -> Bool {
7072 return str. count >= 6
7173 }
72-
74+
7375 func checkButtonEnble( emailText: String ,
7476 passwordText: String ,
7577 passwordConfirmText: String ,
7678 nickName: String ) -> Bool {
7779 return checkEmail ( str: emailText) &&
78- checkEmpty ( [ emailText, passwordText, passwordConfirmText, nickName] ) &&
79- checkSame ( str1: passwordText, str2: passwordConfirmText) &&
80- checkPasswordCount ( str: passwordText)
80+ checkEmpty ( [ emailText, passwordText, passwordConfirmText, nickName] ) &&
81+ checkSame ( str1: passwordText, str2: passwordConfirmText) &&
82+ checkPasswordCount ( str: passwordText)
8183 }
8284}
83-
0 commit comments