From 66aa712ca5424472b64df242fcb66e8e0b880dc7 Mon Sep 17 00:00:00 2001 From: kong <1018dbrud@gmail.com> Date: Tue, 14 Nov 2023 21:47:44 +0900 Subject: [PATCH 1/5] =?UTF-8?q?:lipstick:=20Add:=20LOButton,=20LOTextField?= =?UTF-8?q?=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Layover/Layover.xcodeproj/project.pbxproj | 36 ++++++---- .../Layover/DesignSystem/LOButton.swift | 69 +++++++++++++++++++ .../Layover/DesignSystem/LOTextField.swift | 67 ++++++++++++++++++ 3 files changed, 158 insertions(+), 14 deletions(-) create mode 100644 iOS/Layover/Layover/DesignSystem/LOButton.swift create mode 100644 iOS/Layover/Layover/DesignSystem/LOTextField.swift diff --git a/iOS/Layover/Layover.xcodeproj/project.pbxproj b/iOS/Layover/Layover.xcodeproj/project.pbxproj index 8493e3c..a22f324 100644 --- a/iOS/Layover/Layover.xcodeproj/project.pbxproj +++ b/iOS/Layover/Layover.xcodeproj/project.pbxproj @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */; }; + 19C7AFD62B02584D003B35F2 /* KeychainStored.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */; }; FC49758F2B03432800D8627F /* Pretendard-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */; }; FC4975932B03432800D8627F /* Pretendard-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */; }; FC4975942B03432800D8627F /* Pretendard-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */; }; FC4975992B03439000D8627F /* UIFont+.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC4975982B03439000D8627F /* UIFont+.swift */; }; - 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */; }; - 19C7AFD62B02584D003B35F2 /* KeychainStored.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */; }; FC68E29B2B02325D001AABFF /* Requestable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC68E29A2B02325D001AABFF /* Requestable.swift */; }; FC68E29D2B02326A001AABFF /* Responsable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC68E29C2B02326A001AABFF /* Responsable.swift */; }; FC68E29F2B023315001AABFF /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC68E29E2B023315001AABFF /* HTTPMethod.swift */; }; @@ -35,6 +35,8 @@ FC7E45922AFF747A004F155A /* DummyScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E45912AFF747A004F155A /* DummyScene.swift */; }; FC7E45942AFF7486004F155A /* DummyDesignSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E45932AFF7486004F155A /* DummyDesignSystem.swift */; }; FC7E45962AFF7497004F155A /* DummyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E45952AFF7497004F155A /* DummyExtension.swift */; }; + FCEE0FF22B036B6000195BBE /* LOButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCEE0FF12B036B6000195BBE /* LOButton.swift */; }; + FCEE0FF62B03804000195BBE /* LOTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCEE0FF52B03804000195BBE /* LOTextField.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -55,12 +57,12 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthManager.swift; sourceTree = ""; }; + 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStored.swift; sourceTree = ""; }; FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.ttf"; sourceTree = ""; }; FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Bold.ttf"; sourceTree = ""; }; FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.ttf"; sourceTree = ""; }; FC4975982B03439000D8627F /* UIFont+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+.swift"; sourceTree = ""; }; - 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthManager.swift; sourceTree = ""; }; - 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStored.swift; sourceTree = ""; }; FC68E29A2B02325D001AABFF /* Requestable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Requestable.swift; sourceTree = ""; }; FC68E29C2B02326A001AABFF /* Responsable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Responsable.swift; sourceTree = ""; }; FC68E29E2B023315001AABFF /* HTTPMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPMethod.swift; sourceTree = ""; }; @@ -87,6 +89,8 @@ FC7E45912AFF747A004F155A /* DummyScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyScene.swift; sourceTree = ""; }; FC7E45932AFF7486004F155A /* DummyDesignSystem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyDesignSystem.swift; sourceTree = ""; }; FC7E45952AFF7497004F155A /* DummyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyExtension.swift; sourceTree = ""; }; + FCEE0FF12B036B6000195BBE /* LOButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOButton.swift; sourceTree = ""; }; + FCEE0FF52B03804000195BBE /* LOTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOTextField.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -149,6 +153,16 @@ path = Keychain; sourceTree = ""; }; + FC4975852B0342CE00D8627F /* Fonts */ = { + isa = PBXGroup; + children = ( + FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */, + FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */, + FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */, + ); + path = Fonts; + sourceTree = ""; + }; FC68E2992B02320F001AABFF /* Network */ = { isa = PBXGroup; children = ( @@ -160,16 +174,6 @@ path = Network; sourceTree = ""; }; - FC4975852B0342CE00D8627F /* Fonts */ = { - isa = PBXGroup; - children = ( - FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */, - FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */, - FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */, - ); - path = Fonts; - sourceTree = ""; - }; FC7E452D2AFEB623004F155A = { isa = PBXGroup; children = ( @@ -266,6 +270,8 @@ isa = PBXGroup; children = ( FC7E45932AFF7486004F155A /* DummyDesignSystem.swift */, + FCEE0FF12B036B6000195BBE /* LOButton.swift */, + FCEE0FF52B03804000195BBE /* LOTextField.swift */, ); path = DesignSystem; sourceTree = ""; @@ -452,6 +458,7 @@ FC68E2A32B0233BC001AABFF /* NetworkError.swift in Sources */, FC7E45962AFF7497004F155A /* DummyExtension.swift in Sources */, FC7E458E2AFF7462004F155A /* DummyService.swift in Sources */, + FCEE0FF22B036B6000195BBE /* LOButton.swift in Sources */, FC4975992B03439000D8627F /* UIFont+.swift in Sources */, FC7E458C2AFF7455004F155A /* DummyModel.swift in Sources */, 19C7AFD62B02584D003B35F2 /* KeychainStored.swift in Sources */, @@ -464,6 +471,7 @@ FC68E29F2B023315001AABFF /* HTTPMethod.swift in Sources */, FC7E45942AFF7486004F155A /* DummyDesignSystem.swift in Sources */, FC7E453C2AFEB623004F155A /* SceneDelegate.swift in Sources */, + FCEE0FF62B03804000195BBE /* LOTextField.swift in Sources */, FC68E2A52B0233D3001AABFF /* Provider.swift in Sources */, FC7E45922AFF747A004F155A /* DummyScene.swift in Sources */, ); diff --git a/iOS/Layover/Layover/DesignSystem/LOButton.swift b/iOS/Layover/Layover/DesignSystem/LOButton.swift new file mode 100644 index 0000000..3c9400c --- /dev/null +++ b/iOS/Layover/Layover/DesignSystem/LOButton.swift @@ -0,0 +1,69 @@ +// +// LOButton.swift +// Layover +// +// Created by kong on 2023/11/14. +// + +import UIKit + +final class LOButton: UIButton { + + // MARK: - Button Type + + enum Style { + case basic + } + + // MARK: - Properties + + private let style: Style + + private var buttonBackgroundColor: UIColor { + switch style { + case .basic: + return isEnabled ? .primaryPurple : .darkGrey + } + } + + private var buttonTitleColor: UIColor { + switch style { + case .basic: + return isEnabled ? .white : .grey500 + } + } + + override var isEnabled: Bool { + didSet { + setColors() + } + } + + // MARK: - Initializer + + init(style: Style) { + self.style = style + super.init(frame: .zero) + setInitialStateUI() + } + + required init?(coder: NSCoder) { + self.style = .basic + super.init(coder: coder) + setInitialStateUI() + } + + // MARK: - Custom Method + + private func setInitialStateUI() { + layer.cornerRadius = 8 + titleLabel?.font = .loFont(type: .body2Semibold) + setColors() + } + + private func setColors() { + setTitleColor(buttonTitleColor, for: state) + backgroundColor = buttonBackgroundColor + } + +} diff --git a/iOS/Layover/Layover/DesignSystem/LOTextField.swift b/iOS/Layover/Layover/DesignSystem/LOTextField.swift new file mode 100644 index 0000000..922cb99 --- /dev/null +++ b/iOS/Layover/Layover/DesignSystem/LOTextField.swift @@ -0,0 +1,67 @@ +// +// LOTextField.swift +// Layover +// +// Created by kong on 2023/11/14. +// + +import UIKit + +final class LOTextField: UITextField { + + override var placeholder: String? { + didSet { + setPlaceholderColor() + } + } + + init() { + super.init(frame: .zero) + setUI() + delegate = self + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + setUI() + delegate = self + } + + private func setUI() { + layer.cornerRadius = 8 + layer.borderWidth = 1 + layer.borderColor = UIColor.grey500.cgColor + backgroundColor = UIColor.clear + setPadding() + } + private func setPlaceholderColor() { + guard let placeholder else { return } + attributedPlaceholder = NSAttributedString(string: placeholder, attributes: [.foregroundColor: UIColor.grey500]) + } + + private func setPadding() { + let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: 16, height: frame.height)) + leftView = paddingView + leftViewMode = .always + rightView = paddingView + rightViewMode = .always + } + + private func setFocusStateColors(isFocused: Bool) { + let color = isFocused ? UIColor.grey200 : UIColor.grey500 + layer.borderColor = color.cgColor + textColor = color + } + +} + +extension LOTextField: UITextFieldDelegate { + func textFieldDidBeginEditing(_ textField: UITextField) { + setFocusStateColors(isFocused: true) + } + + func textFieldDidEndEditing(_ textField: UITextField) { + layer.borderColor = UIColor.grey500.cgColor + setFocusStateColors(isFocused: false) + } +} From 726e1d2c9ff0d82434d4a8c00252ba0e6d8cd816 Mon Sep 17 00:00:00 2001 From: kong <1018dbrud@gmail.com> Date: Tue, 14 Nov 2023 22:45:22 +0900 Subject: [PATCH 2/5] :seedling: Add: SignUpViewController Layout --- iOS/Layover/Layover.xcodeproj/project.pbxproj | 12 +++ .../SingUpScene/SignUpViewController.swift | 91 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift diff --git a/iOS/Layover/Layover.xcodeproj/project.pbxproj b/iOS/Layover/Layover.xcodeproj/project.pbxproj index a22f324..789942c 100644 --- a/iOS/Layover/Layover.xcodeproj/project.pbxproj +++ b/iOS/Layover/Layover.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ FC7E45962AFF7497004F155A /* DummyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E45952AFF7497004F155A /* DummyExtension.swift */; }; FCEE0FF22B036B6000195BBE /* LOButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCEE0FF12B036B6000195BBE /* LOButton.swift */; }; FCEE0FF62B03804000195BBE /* LOTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCEE0FF52B03804000195BBE /* LOTextField.swift */; }; + FCEE0FFA2B03AF8500195BBE /* SignUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -91,6 +92,7 @@ FC7E45952AFF7497004F155A /* DummyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyExtension.swift; sourceTree = ""; }; FCEE0FF12B036B6000195BBE /* LOButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOButton.swift; sourceTree = ""; }; FCEE0FF52B03804000195BBE /* LOTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOTextField.swift; sourceTree = ""; }; + FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -261,6 +263,7 @@ FC7E457B2AFF6F9D004F155A /* Scenes */ = { isa = PBXGroup; children = ( + FCEE0FFB2B03AFAA00195BBE /* SingUpScene */, FC7E45912AFF747A004F155A /* DummyScene.swift */, ); path = Scenes; @@ -294,6 +297,14 @@ path = Resources; sourceTree = ""; }; + FCEE0FFB2B03AFAA00195BBE /* SingUpScene */ = { + isa = PBXGroup; + children = ( + FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */, + ); + path = SingUpScene; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -469,6 +480,7 @@ 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */, FC7E45902AFF746E004F155A /* DummyWorker.swift in Sources */, FC68E29F2B023315001AABFF /* HTTPMethod.swift in Sources */, + FCEE0FFA2B03AF8500195BBE /* SignUpViewController.swift in Sources */, FC7E45942AFF7486004F155A /* DummyDesignSystem.swift in Sources */, FC7E453C2AFEB623004F155A /* SceneDelegate.swift in Sources */, FCEE0FF62B03804000195BBE /* LOTextField.swift in Sources */, diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift new file mode 100644 index 0000000..2eb0b74 --- /dev/null +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift @@ -0,0 +1,91 @@ +// +// SignUpViewController.swift +// Layover +// +// Created by kong on 2023/11/14. +// + +import UIKit + +protocol SignUpDisplayLogic { + func displayNicknameValidation(response: Bool) +} + +final class SignUpViewController: UIViewController, SignUpDisplayLogic { + + // MARK: - UI Components + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "여정 기록을 위한\n닉네임을 입력해주세요." + label.numberOfLines = 0 + label.font = .loFont(type: .header2) + label.textColor = .white + return label + }() + + private let nicknameTextfield: LOTextField = { + let textfield = LOTextField() + textfield.placeholder = "닉네임을 입력해주세요." + return textfield + }() + + private let checkDuplicateNicknameButton: LOButton = { + let button = LOButton(style: .basic) + button.isEnabled = false + button.setTitle("중복확인", for: .normal) + return button + }() + + private let confirmButton: LOButton = { + let button = LOButton(style: .basic) + button.isEnabled = true + button.setTitle("회원가입", for: .normal) + return button + }() + + // MARK: - Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .background // TODO: Base ViewController 로직으로 분리 + setUI() + + } + // MARK: - UI + Layout + + private func setUI() { + [titleLabel, nicknameTextfield, checkDuplicateNicknameButton, confirmButton].forEach { + view.addSubview($0) + $0.translatesAutoresizingMaskIntoConstraints = false + } + + NSLayoutConstraint.activate([ + titleLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 17), + titleLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), + titleLabel.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16), + + nicknameTextfield.heightAnchor.constraint(equalToConstant: 44), + nicknameTextfield.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 17), + nicknameTextfield.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), + nicknameTextfield.trailingAnchor.constraint(equalTo: checkDuplicateNicknameButton.leadingAnchor, constant: -16), + + checkDuplicateNicknameButton.heightAnchor.constraint(equalToConstant: 44), + checkDuplicateNicknameButton.widthAnchor.constraint(equalToConstant: 83), + checkDuplicateNicknameButton.centerYAnchor.constraint(equalTo: nicknameTextfield.centerYAnchor), + checkDuplicateNicknameButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16), + + confirmButton.heightAnchor.constraint(equalToConstant: 50), + confirmButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + confirmButton.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), + confirmButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16) + ]) + } + + // MARK: - Custom Method + + func displayNicknameValidation(response: Bool) { + + } + +} From 4bf29b9b9a226b70b04c5caa719cffb7108449f2 Mon Sep 17 00:00:00 2001 From: kong <1018dbrud@gmail.com> Date: Wed, 15 Nov 2023 04:22:37 +0900 Subject: [PATCH 3/5] =?UTF-8?q?:sparkles:=20feat:=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EC=B2=98=EB=A6=AC,?= =?UTF-8?q?=20=ED=82=A4=EB=B3=B4=EB=93=9C=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Layover/Layover.xcodeproj/project.pbxproj | 2 +- .../SignUpViewController.swift | 80 +++++++++++++++++-- 2 files changed, 73 insertions(+), 9 deletions(-) rename iOS/Layover/Layover/Scenes/{SingUpScene => }/SignUpViewController.swift (51%) diff --git a/iOS/Layover/Layover.xcodeproj/project.pbxproj b/iOS/Layover/Layover.xcodeproj/project.pbxproj index 789942c..f0b4894 100644 --- a/iOS/Layover/Layover.xcodeproj/project.pbxproj +++ b/iOS/Layover/Layover.xcodeproj/project.pbxproj @@ -92,7 +92,7 @@ FC7E45952AFF7497004F155A /* DummyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyExtension.swift; sourceTree = ""; }; FCEE0FF12B036B6000195BBE /* LOButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOButton.swift; sourceTree = ""; }; FCEE0FF52B03804000195BBE /* LOTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOTextField.swift; sourceTree = ""; }; - FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewController.swift; sourceTree = ""; }; + FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SignUpViewController.swift; path = ../SignUpViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift b/iOS/Layover/Layover/Scenes/SignUpViewController.swift similarity index 51% rename from iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift rename to iOS/Layover/Layover/Scenes/SignUpViewController.swift index 2eb0b74..7da4108 100644 --- a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpViewController.swift +++ b/iOS/Layover/Layover/Scenes/SignUpViewController.swift @@ -13,6 +13,23 @@ protocol SignUpDisplayLogic { final class SignUpViewController: UIViewController, SignUpDisplayLogic { + enum NicknameState { + case valid + case lessThan2GreaterThan8 + case invalidCharacter + + var alertDescription: String? { + switch self { + case .valid: + return nil + case .lessThan2GreaterThan8: + return "2자 이상 8자 이하로 입력해주세요." + case .invalidCharacter: + return "입력할 수 없는 문자입니다." + } + } + } + // MARK: - UI Components private let titleLabel: UILabel = { @@ -24,10 +41,18 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { return label }() - private let nicknameTextfield: LOTextField = { - let textfield = LOTextField() - textfield.placeholder = "닉네임을 입력해주세요." - return textfield + private lazy var nicknameTextfield: LOTextField = { + let textField = LOTextField() + textField.placeholder = "닉네임을 입력해주세요." + textField.addTarget(self, action: #selector(setUpTextFieldState(_:)), for: .editingChanged) + return textField + }() + + private let nicknameAlertLabel: UILabel = { + let label = UILabel() + label.font = .loFont(type: .caption) + label.textColor = .error + return label }() private let checkDuplicateNicknameButton: LOButton = { @@ -39,7 +64,7 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { private let confirmButton: LOButton = { let button = LOButton(style: .basic) - button.isEnabled = true + button.isEnabled = false button.setTitle("회원가입", for: .normal) return button }() @@ -48,14 +73,17 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .background // TODO: Base ViewController 로직으로 분리 setUI() + // TODO: Base ViewController 로직으로 분리 + view.backgroundColor = .background + addTapGesture() } + // MARK: - UI + Layout private func setUI() { - [titleLabel, nicknameTextfield, checkDuplicateNicknameButton, confirmButton].forEach { + [titleLabel, nicknameTextfield, nicknameAlertLabel, checkDuplicateNicknameButton, confirmButton].forEach { view.addSubview($0) $0.translatesAutoresizingMaskIntoConstraints = false } @@ -70,13 +98,17 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { nicknameTextfield.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), nicknameTextfield.trailingAnchor.constraint(equalTo: checkDuplicateNicknameButton.leadingAnchor, constant: -16), + nicknameAlertLabel.topAnchor.constraint(equalTo: nicknameTextfield.bottomAnchor, constant: 5), + nicknameAlertLabel.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), + nicknameTextfield.trailingAnchor.constraint(equalTo: nicknameTextfield.trailingAnchor), + checkDuplicateNicknameButton.heightAnchor.constraint(equalToConstant: 44), checkDuplicateNicknameButton.widthAnchor.constraint(equalToConstant: 83), checkDuplicateNicknameButton.centerYAnchor.constraint(equalTo: nicknameTextfield.centerYAnchor), checkDuplicateNicknameButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16), confirmButton.heightAnchor.constraint(equalToConstant: 50), - confirmButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + confirmButton.bottomAnchor.constraint(equalTo: view.keyboardLayoutGuide.topAnchor), confirmButton.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor, constant: 16), confirmButton.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor, constant: -16) ]) @@ -88,4 +120,36 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { } + private func addTapGesture() { + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(hideKeyboard(_:))) + view.addGestureRecognizer(tapGesture) + } + + private func validate(nickname: String) -> NicknameState { + if nickname.count < 2 || nickname.count > 8 { + return .lessThan2GreaterThan8 + } else if nickname.wholeMatch(of: /^[a-zA-Z0-9ㄱ-ㅎㅏ-ㅣ가-힣]+/) == nil { + return .invalidCharacter + } + return .valid + } + + @objc private func hideKeyboard(_ sender: Any) { + view.endEditing(true) + } + + @objc private func setUpTextFieldState(_ sender: UITextField) { + guard let nickname = sender.text else { return } + let nicknameState = validate(nickname: nickname) + switch nicknameState { + case .valid: + nicknameAlertLabel.isHidden = true + checkDuplicateNicknameButton.isEnabled = true + case .lessThan2GreaterThan8, .invalidCharacter: + nicknameAlertLabel.isHidden = false + checkDuplicateNicknameButton.isEnabled = false + nicknameAlertLabel.text = nicknameState.alertDescription + } + } + } From c53480570e6e0f6b925ff380b1bd245c4847b7f4 Mon Sep 17 00:00:00 2001 From: anyukyung <1018dbrud@gmail.com> Date: Wed, 15 Nov 2023 15:03:35 +0900 Subject: [PATCH 4/5] =?UTF-8?q?:recycle:=20Refactor:=20=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=20=EA=B2=80=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20VIP=20?= =?UTF-8?q?=EC=82=AC=EC=9D=B4=ED=81=B4=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iOS/Layover/Layover.xcodeproj/project.pbxproj | 18 +++++- .../Layover/Scenes/SignUpViewController.swift | 58 ++++++------------- .../SingUpScene/SignUpConfigurator.swift | 26 +++++++++ .../Scenes/SingUpScene/SignUpInteractor.swift | 41 +++++++++++++ .../Scenes/SingUpScene/SignUpModels.swift | 45 ++++++++++++++ .../Scenes/SingUpScene/SignUpPresenter.swift | 30 ++++++++++ 6 files changed, 176 insertions(+), 42 deletions(-) create mode 100644 iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift create mode 100644 iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift create mode 100644 iOS/Layover/Layover/Scenes/SingUpScene/SignUpModels.swift create mode 100644 iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift diff --git a/iOS/Layover/Layover.xcodeproj/project.pbxproj b/iOS/Layover/Layover.xcodeproj/project.pbxproj index c15d6b9..0e325c6 100644 --- a/iOS/Layover/Layover.xcodeproj/project.pbxproj +++ b/iOS/Layover/Layover.xcodeproj/project.pbxproj @@ -21,6 +21,10 @@ 194552132B03AFFC00299768 /* DummyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194552122B03AFFC00299768 /* DummyViewController.swift */; }; 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */; }; 19C7AFD62B02584D003B35F2 /* KeychainStored.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */; }; + FC2511A02B045C0A004717BC /* SignUpInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC25119F2B045C0A004717BC /* SignUpInteractor.swift */; }; + FC2511A22B045C3F004717BC /* SignUpPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC2511A12B045C3F004717BC /* SignUpPresenter.swift */; }; + FC2511A42B045D6C004717BC /* SignUpModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC2511A32B045D6C004717BC /* SignUpModels.swift */; }; + FC2511A62B049020004717BC /* SignUpConfigurator.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC2511A52B049020004717BC /* SignUpConfigurator.swift */; }; FC49758F2B03432800D8627F /* Pretendard-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */; }; FC4975932B03432800D8627F /* Pretendard-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */; }; FC4975942B03432800D8627F /* Pretendard-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */; }; @@ -82,6 +86,10 @@ 194552122B03AFFC00299768 /* DummyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DummyViewController.swift; sourceTree = ""; }; 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthManager.swift; sourceTree = ""; }; 19C7AFD52B02584D003B35F2 /* KeychainStored.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStored.swift; sourceTree = ""; }; + FC25119F2B045C0A004717BC /* SignUpInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpInteractor.swift; sourceTree = ""; }; + FC2511A12B045C3F004717BC /* SignUpPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpPresenter.swift; sourceTree = ""; }; + FC2511A32B045D6C004717BC /* SignUpModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpModels.swift; sourceTree = ""; }; + FC2511A52B049020004717BC /* SignUpConfigurator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpConfigurator.swift; sourceTree = ""; }; FC4975862B03432700D8627F /* Pretendard-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.ttf"; sourceTree = ""; }; FC49758A2B03432800D8627F /* Pretendard-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Bold.ttf"; sourceTree = ""; }; FC49758B2B03432800D8627F /* Pretendard-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.ttf"; sourceTree = ""; }; @@ -307,8 +315,8 @@ FC7E457B2AFF6F9D004F155A /* Scenes */ = { isa = PBXGroup; children = ( - FCEE0FFB2B03AFAA00195BBE /* SingUpScene */, 1945520E2B03AEA400299768 /* Configurator.swift */, + FCEE0FFB2B03AFAA00195BBE /* SingUpScene */, 194552032B038FC400299768 /* Tabbar */, 194551EB2B037F1E00299768 /* Login */, FC7E45912AFF747A004F155A /* DummyScene.swift */, @@ -349,6 +357,10 @@ isa = PBXGroup; children = ( FCEE0FF92B03AF8400195BBE /* SignUpViewController.swift */, + FC25119F2B045C0A004717BC /* SignUpInteractor.swift */, + FC2511A12B045C3F004717BC /* SignUpPresenter.swift */, + FC2511A32B045D6C004717BC /* SignUpModels.swift */, + FC2511A52B049020004717BC /* SignUpConfigurator.swift */, ); path = SingUpScene; sourceTree = ""; @@ -496,6 +508,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + FC2511A42B045D6C004717BC /* SignUpModels.swift in Sources */, FC68E2A12B023326001AABFF /* EndPoint.swift in Sources */, FC68E2A32B0233BC001AABFF /* NetworkError.swift in Sources */, FC7E45962AFF7497004F155A /* DummyExtension.swift in Sources */, @@ -503,6 +516,7 @@ 194551F62B037F2D00299768 /* LoginViewController.swift in Sources */, FC7E458E2AFF7462004F155A /* DummyService.swift in Sources */, FCEE0FF22B036B6000195BBE /* LOButton.swift in Sources */, + FC2511A62B049020004717BC /* SignUpConfigurator.swift in Sources */, 194552132B03AFFC00299768 /* DummyViewController.swift in Sources */, 194551F22B037F2D00299768 /* LoginPresenter.swift in Sources */, 194552022B038B8300299768 /* OSLog+.swift in Sources */, @@ -514,7 +528,9 @@ FC7E458A2AFF70FB004F155A /* ViewController.swift in Sources */, FC7E453A2AFEB623004F155A /* AppDelegate.swift in Sources */, FC68E29B2B02325D001AABFF /* Requestable.swift in Sources */, + FC2511A22B045C3F004717BC /* SignUpPresenter.swift in Sources */, FC68E29D2B02326A001AABFF /* Responsable.swift in Sources */, + FC2511A02B045C0A004717BC /* SignUpInteractor.swift in Sources */, 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */, FC7E45902AFF746E004F155A /* DummyWorker.swift in Sources */, 1945520F2B03AEA400299768 /* Configurator.swift in Sources */, diff --git a/iOS/Layover/Layover/Scenes/SignUpViewController.swift b/iOS/Layover/Layover/Scenes/SignUpViewController.swift index 7da4108..f3c7d42 100644 --- a/iOS/Layover/Layover/Scenes/SignUpViewController.swift +++ b/iOS/Layover/Layover/Scenes/SignUpViewController.swift @@ -3,33 +3,18 @@ // Layover // // Created by kong on 2023/11/14. +// Copyright © 2023 CodeBomber. All rights reserved. // import UIKit -protocol SignUpDisplayLogic { - func displayNicknameValidation(response: Bool) +protocol SignUpDisplayLogic: AnyObject { + func displayNicknameValidation(response: SignUpModels.ValidateNickname.ViewModel) + func displayNickanmeDuplication() } final class SignUpViewController: UIViewController, SignUpDisplayLogic { - enum NicknameState { - case valid - case lessThan2GreaterThan8 - case invalidCharacter - - var alertDescription: String? { - switch self { - case .valid: - return nil - case .lessThan2GreaterThan8: - return "2자 이상 8자 이하로 입력해주세요." - case .invalidCharacter: - return "입력할 수 없는 문자입니다." - } - } - } - // MARK: - UI Components private let titleLabel: UILabel = { @@ -69,10 +54,13 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { return button }() + var interactor: SignUpBusinessLogic? + // MARK: - Life Cycle override func viewDidLoad() { super.viewDidLoad() + SignUpConfigurator.sharedInstance.configure(self) setUI() // TODO: Base ViewController 로직으로 분리 @@ -116,7 +104,13 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { // MARK: - Custom Method - func displayNicknameValidation(response: Bool) { + func displayNicknameValidation(response: SignUpModels.ValidateNickname.ViewModel) { + nicknameAlertLabel.isHidden = response.canCheckDuplication + checkDuplicateNicknameButton.isEnabled = response.canCheckDuplication + nicknameAlertLabel.text = response.alertDescription + } + + func displayNickanmeDuplication() { } @@ -125,31 +119,13 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { view.addGestureRecognizer(tapGesture) } - private func validate(nickname: String) -> NicknameState { - if nickname.count < 2 || nickname.count > 8 { - return .lessThan2GreaterThan8 - } else if nickname.wholeMatch(of: /^[a-zA-Z0-9ㄱ-ㅎㅏ-ㅣ가-힣]+/) == nil { - return .invalidCharacter - } - return .valid + @objc private func setUpTextFieldState(_ sender: UITextField) { + guard let nickname = sender.text else { return } + interactor?.validateNickname(with: SignUpModels.ValidateNickname.Request(nickname: nickname)) } @objc private func hideKeyboard(_ sender: Any) { view.endEditing(true) } - @objc private func setUpTextFieldState(_ sender: UITextField) { - guard let nickname = sender.text else { return } - let nicknameState = validate(nickname: nickname) - switch nicknameState { - case .valid: - nicknameAlertLabel.isHidden = true - checkDuplicateNicknameButton.isEnabled = true - case .lessThan2GreaterThan8, .invalidCharacter: - nicknameAlertLabel.isHidden = false - checkDuplicateNicknameButton.isEnabled = false - nicknameAlertLabel.text = nicknameState.alertDescription - } - } - } diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift new file mode 100644 index 0000000..85a768f --- /dev/null +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift @@ -0,0 +1,26 @@ +// +// SignUpConfigurator.swift +// Layover +// +// Created by kong on 2023/11/15. +// Copyright © 2023 CodeBomber. All rights reserved. +// + +import Foundation + +final class SignUpConfigurator: Configurator { + typealias T = SignUpViewController + + static let sharedInstance = SignUpConfigurator() + + private init() { } + + func configure(_ viewController: SignUpViewController) { + let viewController = viewController + let interactor = SignUpInteractor() + let presenter = SignUpPresenter() + viewController.interactor = interactor + interactor.presenter = presenter + presenter.viewController = viewController + } +} diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift new file mode 100644 index 0000000..ba4671c --- /dev/null +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift @@ -0,0 +1,41 @@ +// +// SignUpInteractor.swift +// Layover +// +// Created by kong on 2023/11/15. +// Copyright © 2023 CodeBomber. All rights reserved. +// + +import UIKit + +protocol SignUpBusinessLogic { + func validateNickname(with request: SignUpModels.ValidateNickname.Request) +} + +protocol SignUpDataStore { } + +class SignUpInteractor: SignUpBusinessLogic, SignUpDataStore { + + // MARK: - Properties + + typealias Models = SignUpModels + + var presenter: SignUpPresentationLogic? + + // MARK: - UseCase: 닉네임 유효성 검사 + + func validateNickname(with request: SignUpModels.ValidateNickname.Request) { + let response = check(nickname: request.nickname) + presenter?.presentNicknameValidation(with: response) + } + + private func check(nickname: String) -> SignUpModels.ValidateNickname.Response { + if nickname.count < 2 || nickname.count > 8 { + return .init(nicknameState: .lessThan2GreaterThan8) + } else if nickname.wholeMatch(of: /^[a-zA-Z0-9ㄱ-ㅎㅏ-ㅣ가-힣]+/) == nil { + return .init(nicknameState: .invalidCharacter) + } + return .init(nicknameState: .valid) + } + +} diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpModels.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpModels.swift new file mode 100644 index 0000000..0bb197b --- /dev/null +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpModels.swift @@ -0,0 +1,45 @@ +// +// SignUpModels.swift +// Layover +// +// Created by kong on 2023/11/15. +// Copyright © 2023 CodeBomber. All rights reserved. +// + +import UIKit + +enum SignUpModels { + + // MARK: - Use Cases + + enum ValidateNickname { + struct Request { + var nickname: String + } + struct Response { + var nicknameState: NicknameState + } + struct ViewModel { + var canCheckDuplication: Bool + var alertDescription: String? + } + } + + // MARK: - State Type + enum NicknameState { + case valid + case lessThan2GreaterThan8 + case invalidCharacter + + var alertDescription: String? { + switch self { + case .valid: + return nil + case .lessThan2GreaterThan8: + return "2자 이상 8자 이하로 입력해주세요." + case .invalidCharacter: + return "입력할 수 없는 문자입니다." + } + } + } +} diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift new file mode 100644 index 0000000..8006068 --- /dev/null +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift @@ -0,0 +1,30 @@ +// +// SignUpPresenter.swift +// Layover +// +// Created by kong on 2023/11/15. +// Copyright © 2023 CodeBomber. All rights reserved. +// + +import UIKit + +protocol SignUpPresentationLogic { + func presentNicknameValidation(with response: SignUpModels.ValidateNickname.Response) +} + +class SignUpPresenter: SignUpPresentationLogic { + + // MARK: - Properties + + typealias Models = SignUpModels + weak var viewController: SignUpDisplayLogic? + + // MARK: - UseCase: 닉네임 유효성 검사 + + func presentNicknameValidation(with response: SignUpModels.ValidateNickname.Response) { + let viewModel = Models.ValidateNickname.ViewModel(canCheckDuplication: response.nicknameState == .valid, + alertDescription: response.nicknameState.alertDescription) + viewController?.displayNicknameValidation(response: viewModel) + } + +} From 79a2547d2934092243ad8cbdfdf3df751ece1762 Mon Sep 17 00:00:00 2001 From: anyukyung <1018dbrud@gmail.com> Date: Wed, 15 Nov 2023 15:37:07 +0900 Subject: [PATCH 5/5] =?UTF-8?q?:recycle:=20Refactor:=20final=20=ED=82=A4?= =?UTF-8?q?=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B0=80,=20shared=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95,=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EC=9D=B5=EC=8A=A4=ED=85=90=EC=85=98?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layover/Scenes/SignUpViewController.swift | 27 ++++++++++--------- .../SingUpScene/SignUpConfigurator.swift | 2 +- .../Scenes/SingUpScene/SignUpInteractor.swift | 2 +- .../Scenes/SingUpScene/SignUpPresenter.swift | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/iOS/Layover/Layover/Scenes/SignUpViewController.swift b/iOS/Layover/Layover/Scenes/SignUpViewController.swift index f3c7d42..4f435d4 100644 --- a/iOS/Layover/Layover/Scenes/SignUpViewController.swift +++ b/iOS/Layover/Layover/Scenes/SignUpViewController.swift @@ -13,8 +13,8 @@ protocol SignUpDisplayLogic: AnyObject { func displayNickanmeDuplication() } -final class SignUpViewController: UIViewController, SignUpDisplayLogic { - +final class SignUpViewController: UIViewController { + // MARK: - UI Components private let titleLabel: UILabel = { @@ -60,7 +60,7 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { override func viewDidLoad() { super.viewDidLoad() - SignUpConfigurator.sharedInstance.configure(self) + SignUpConfigurator.shared.configure(self) setUI() // TODO: Base ViewController 로직으로 분리 @@ -104,16 +104,6 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { // MARK: - Custom Method - func displayNicknameValidation(response: SignUpModels.ValidateNickname.ViewModel) { - nicknameAlertLabel.isHidden = response.canCheckDuplication - checkDuplicateNicknameButton.isEnabled = response.canCheckDuplication - nicknameAlertLabel.text = response.alertDescription - } - - func displayNickanmeDuplication() { - - } - private func addTapGesture() { let tapGesture = UITapGestureRecognizer(target: self, action: #selector(hideKeyboard(_:))) view.addGestureRecognizer(tapGesture) @@ -127,5 +117,16 @@ final class SignUpViewController: UIViewController, SignUpDisplayLogic { @objc private func hideKeyboard(_ sender: Any) { view.endEditing(true) } +} + +extension SignUpViewController: SignUpDisplayLogic { + func displayNicknameValidation(response: SignUpModels.ValidateNickname.ViewModel) { + nicknameAlertLabel.isHidden = response.canCheckDuplication + checkDuplicateNicknameButton.isEnabled = response.canCheckDuplication + nicknameAlertLabel.text = response.alertDescription + } + func displayNickanmeDuplication() { + + } } diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift index 85a768f..9608e5e 100644 --- a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpConfigurator.swift @@ -11,7 +11,7 @@ import Foundation final class SignUpConfigurator: Configurator { typealias T = SignUpViewController - static let sharedInstance = SignUpConfigurator() + static let shared = SignUpConfigurator() private init() { } diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift index ba4671c..47dc48d 100644 --- a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpInteractor.swift @@ -14,7 +14,7 @@ protocol SignUpBusinessLogic { protocol SignUpDataStore { } -class SignUpInteractor: SignUpBusinessLogic, SignUpDataStore { +final class SignUpInteractor: SignUpBusinessLogic, SignUpDataStore { // MARK: - Properties diff --git a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift index 8006068..67c0ee3 100644 --- a/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift +++ b/iOS/Layover/Layover/Scenes/SingUpScene/SignUpPresenter.swift @@ -12,7 +12,7 @@ protocol SignUpPresentationLogic { func presentNicknameValidation(with response: SignUpModels.ValidateNickname.Response) } -class SignUpPresenter: SignUpPresentationLogic { +final class SignUpPresenter: SignUpPresentationLogic { // MARK: - Properties