diff --git a/assignment/assignment.xcodeproj/project.pbxproj b/assignment/assignment.xcodeproj/project.pbxproj index a6b2b7d..c14bb8f 100644 --- a/assignment/assignment.xcodeproj/project.pbxproj +++ b/assignment/assignment.xcodeproj/project.pbxproj @@ -7,15 +7,27 @@ objects = { /* Begin PBXBuildFile section */ + 980D11D327FD56770009F772 /* Login.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 980D11D227FD56770009F772 /* Login.storyboard */; }; + 980D11D527FD567D0009F772 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980D11D427FD567D0009F772 /* LoginViewController.swift */; }; + 980D11D827FD56910009F772 /* Join.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 980D11D727FD56910009F772 /* Join.storyboard */; }; + 980D11DD27FD57D30009F772 /* Complete.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 980D11DC27FD57D30009F772 /* Complete.storyboard */; }; + 980D11DF27FD57DA0009F772 /* CompleteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 980D11DE27FD57DA0009F772 /* CompleteViewController.swift */; }; 985946A527FA7E5C00F7610D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 985946A427FA7E5C00F7610D /* AppDelegate.swift */; }; 985946A727FA7E5C00F7610D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 985946A627FA7E5C00F7610D /* SceneDelegate.swift */; }; 985946A927FA7E5C00F7610D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 985946A827FA7E5C00F7610D /* ViewController.swift */; }; 985946AC27FA7E5C00F7610D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 985946AA27FA7E5C00F7610D /* Main.storyboard */; }; 985946AE27FA7E5C00F7610D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 985946AD27FA7E5C00F7610D /* Assets.xcassets */; }; 985946B127FA7E5C00F7610D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 985946AF27FA7E5C00F7610D /* LaunchScreen.storyboard */; }; + 98967EF927FD5EB60031138C /* JoinNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98967EF827FD5EB60031138C /* JoinNameViewController.swift */; }; + 98967EFB27FD5ECE0031138C /* JoinPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98967EFA27FD5ECE0031138C /* JoinPasswordViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 980D11D227FD56770009F772 /* Login.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Login.storyboard; sourceTree = ""; }; + 980D11D427FD567D0009F772 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; + 980D11D727FD56910009F772 /* Join.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Join.storyboard; sourceTree = ""; }; + 980D11DC27FD57D30009F772 /* Complete.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Complete.storyboard; sourceTree = ""; }; + 980D11DE27FD57DA0009F772 /* CompleteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteViewController.swift; sourceTree = ""; }; 985946A127FA7E5C00F7610D /* assignment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = assignment.app; sourceTree = BUILT_PRODUCTS_DIR; }; 985946A427FA7E5C00F7610D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 985946A627FA7E5C00F7610D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -24,6 +36,8 @@ 985946AD27FA7E5C00F7610D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 985946B027FA7E5C00F7610D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 985946B227FA7E5C00F7610D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 98967EF827FD5EB60031138C /* JoinNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinNameViewController.swift; sourceTree = ""; }; + 98967EFA27FD5ECE0031138C /* JoinPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinPasswordViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -37,6 +51,57 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 980D11CA27FD55130009F772 /* Supports */ = { + isa = PBXGroup; + children = ( + 985946AF27FA7E5C00F7610D /* LaunchScreen.storyboard */, + 985946AD27FA7E5C00F7610D /* Assets.xcassets */, + 985946A427FA7E5C00F7610D /* AppDelegate.swift */, + 985946A627FA7E5C00F7610D /* SceneDelegate.swift */, + ); + path = Supports; + sourceTree = ""; + }; + 980D11CB27FD55380009F772 /* Scene */ = { + isa = PBXGroup; + children = ( + 980D11D127FD56700009F772 /* Login */, + 980D11D627FD56890009F772 /* Join */, + 980D11DB27FD57C90009F772 /* Complete */, + 985946A827FA7E5C00F7610D /* ViewController.swift */, + 985946AA27FA7E5C00F7610D /* Main.storyboard */, + ); + path = Scene; + sourceTree = ""; + }; + 980D11D127FD56700009F772 /* Login */ = { + isa = PBXGroup; + children = ( + 980D11D227FD56770009F772 /* Login.storyboard */, + 980D11D427FD567D0009F772 /* LoginViewController.swift */, + ); + path = Login; + sourceTree = ""; + }; + 980D11D627FD56890009F772 /* Join */ = { + isa = PBXGroup; + children = ( + 980D11D727FD56910009F772 /* Join.storyboard */, + 98967EF827FD5EB60031138C /* JoinNameViewController.swift */, + 98967EFA27FD5ECE0031138C /* JoinPasswordViewController.swift */, + ); + path = Join; + sourceTree = ""; + }; + 980D11DB27FD57C90009F772 /* Complete */ = { + isa = PBXGroup; + children = ( + 980D11DC27FD57D30009F772 /* Complete.storyboard */, + 980D11DE27FD57DA0009F772 /* CompleteViewController.swift */, + ); + path = Complete; + sourceTree = ""; + }; 9859469827FA7E5C00F7610D = { isa = PBXGroup; children = ( @@ -56,12 +121,8 @@ 985946A327FA7E5C00F7610D /* assignment */ = { isa = PBXGroup; children = ( - 985946A427FA7E5C00F7610D /* AppDelegate.swift */, - 985946A627FA7E5C00F7610D /* SceneDelegate.swift */, - 985946A827FA7E5C00F7610D /* ViewController.swift */, - 985946AA27FA7E5C00F7610D /* Main.storyboard */, - 985946AD27FA7E5C00F7610D /* Assets.xcassets */, - 985946AF27FA7E5C00F7610D /* LaunchScreen.storyboard */, + 980D11CA27FD55130009F772 /* Supports */, + 980D11CB27FD55380009F772 /* Scene */, 985946B227FA7E5C00F7610D /* Info.plist */, ); path = assignment; @@ -125,9 +186,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 980D11D327FD56770009F772 /* Login.storyboard in Resources */, + 980D11DD27FD57D30009F772 /* Complete.storyboard in Resources */, 985946B127FA7E5C00F7610D /* LaunchScreen.storyboard in Resources */, 985946AE27FA7E5C00F7610D /* Assets.xcassets in Resources */, 985946AC27FA7E5C00F7610D /* Main.storyboard in Resources */, + 980D11D827FD56910009F772 /* Join.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -138,9 +202,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 980D11D527FD567D0009F772 /* LoginViewController.swift in Sources */, + 98967EFB27FD5ECE0031138C /* JoinPasswordViewController.swift in Sources */, 985946A927FA7E5C00F7610D /* ViewController.swift in Sources */, 985946A527FA7E5C00F7610D /* AppDelegate.swift in Sources */, 985946A727FA7E5C00F7610D /* SceneDelegate.swift in Sources */, + 980D11DF27FD57DA0009F772 /* CompleteViewController.swift in Sources */, + 98967EF927FD5EB60031138C /* JoinNameViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/assignment/assignment/Info.plist b/assignment/assignment/Info.plist index dd3c9af..4c7ff50 100644 --- a/assignment/assignment/Info.plist +++ b/assignment/assignment/Info.plist @@ -16,7 +16,7 @@ UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate UISceneStoryboardFile - Main + Login diff --git a/assignment/assignment/Base.lproj/Main.storyboard b/assignment/assignment/Scene/Base.lproj/Main.storyboard similarity index 100% rename from assignment/assignment/Base.lproj/Main.storyboard rename to assignment/assignment/Scene/Base.lproj/Main.storyboard diff --git a/assignment/assignment/Scene/Complete/Complete.storyboard b/assignment/assignment/Scene/Complete/Complete.storyboard new file mode 100644 index 0000000..7c3d393 --- /dev/null +++ b/assignment/assignment/Scene/Complete/Complete.storyboard @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assignment/assignment/Scene/Complete/CompleteViewController.swift b/assignment/assignment/Scene/Complete/CompleteViewController.swift new file mode 100644 index 0000000..cba32ab --- /dev/null +++ b/assignment/assignment/Scene/Complete/CompleteViewController.swift @@ -0,0 +1,48 @@ +// +// CompleteViewController.swift +// assignment +// +// Created by 이경민 on 2022/04/06. +// + +import UIKit + +final class CompleteViewController: UIViewController { + + // MARK: - Property + + var userName: String = "" + + // MARK: - IBOutlet + + @IBOutlet weak var welcomeLabel: UILabel! + @IBOutlet weak var completeButton: UIButton! + + // MARK: - LifeCycle + + override func viewDidLoad() { + super.viewDidLoad() + setUI() + setUserName() + } + + // MARK: - Function + + private func setUI() { + setButtonUI() + } + + private func setButtonUI() { + completeButton.layer.cornerRadius = 15 + } + + private func setUserName() { + welcomeLabel.text = "\(userName)님 Instagram에 오신 것을 환영합니다" + } + + // MARK: - IBAction + + @IBAction func completeButtonDidTap(_ sender: Any) { + self.dismiss(animated: true) + } +} diff --git a/assignment/assignment/Scene/Join/Join.storyboard b/assignment/assignment/Scene/Join/Join.storyboard new file mode 100644 index 0000000..1964b6a --- /dev/null +++ b/assignment/assignment/Scene/Join/Join.storyboard @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assignment/assignment/Scene/Join/JoinNameViewController.swift b/assignment/assignment/Scene/Join/JoinNameViewController.swift new file mode 100644 index 0000000..4a78a09 --- /dev/null +++ b/assignment/assignment/Scene/Join/JoinNameViewController.swift @@ -0,0 +1,65 @@ +// +// JoinNameViewController.swift +// assignment +// +// Created by 이경민 on 2022/04/06. +// + +import UIKit + +final class JoinNameViewController: UIViewController { + + // MARK: - IBOutlet + + @IBOutlet weak var nameTextField: UITextField! + @IBOutlet weak var nextButton: UIButton! + + // MARK: - LifeCycle + + override func viewDidLoad() { + super.viewDidLoad() + setUI() + setTextField() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + removeTextField() + } + + // MARK: - Function + + private func setUI() { + setButtonUI() + } + + private func setButtonUI() { + nextButton.layer.cornerRadius = 15 + } + + private func setTextField() { + nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) + } + + private func removeTextField() { + nameTextField.text?.removeAll() + } + + // MARK: - objc function + + @objc func textFieldDidChange(_ sender: UITextField) { + nextButton.isEnabled = nameTextField.hasText + } + + // MARK: - IBAction + + @IBAction func backButtonDidTap(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } + + @IBAction func nextButtonDidTap(_ sender: Any) { + guard let passwordVC = self.storyboard?.instantiateViewController(withIdentifier: "JoinPasswordViewController") as? JoinPasswordViewController else { return } + passwordVC.userName = nameTextField.text ?? "" + self.navigationController?.pushViewController(passwordVC, animated: true) + } +} diff --git a/assignment/assignment/Scene/Join/JoinPasswordViewController.swift b/assignment/assignment/Scene/Join/JoinPasswordViewController.swift new file mode 100644 index 0000000..029bb6f --- /dev/null +++ b/assignment/assignment/Scene/Join/JoinPasswordViewController.swift @@ -0,0 +1,73 @@ +// +// JoinPasswordViewController.swift +// assignment +// +// Created by 이경민 on 2022/04/06. +// + +import UIKit + +final class JoinPasswordViewController: UIViewController { + + // MARK: - Property + + var userName: String = "" + + // MARK: - IBOutlet + + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var nextButton: UIButton! + + // MARK: - LifeCycle + + override func viewDidLoad() { + super.viewDidLoad() + setUI() + setTextField() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + removeTextField() + } + + // MARK: - Function + + private func setUI() { + setButtonUI() + } + + private func setButtonUI() { + nextButton.layer.cornerRadius = 15 + } + + private func setTextField() { + passwordTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) + } + + private func removeTextField() { + passwordTextField.text?.removeAll() + } + + // MARK: - objc function + + @objc func textFieldDidChange(_ sender: UITextField) { + nextButton.isEnabled = passwordTextField.hasText + } + + // MARK: - IBAction + + @IBAction func backButtonDidTap(_ sender: Any) { + self.navigationController?.popViewController(animated: true) + } + + @IBAction func nextButtonDidTap(_ sender: Any) { + guard let completeVC = UIStoryboard(name: "Complete", bundle: nil).instantiateViewController(withIdentifier: "CompleteViewController") as? CompleteViewController else { return } + completeVC.modalTransitionStyle = .crossDissolve + completeVC.modalPresentationStyle = .fullScreen + completeVC.userName = userName + self.present(completeVC, animated: true) { + self.navigationController?.popToRootViewController(animated: false) + } + } +} diff --git a/assignment/assignment/Scene/Login/Login.storyboard b/assignment/assignment/Scene/Login/Login.storyboard new file mode 100644 index 0000000..c12bb6e --- /dev/null +++ b/assignment/assignment/Scene/Login/Login.storyboard @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assignment/assignment/Scene/Login/LoginViewController.swift b/assignment/assignment/Scene/Login/LoginViewController.swift new file mode 100644 index 0000000..67de7f3 --- /dev/null +++ b/assignment/assignment/Scene/Login/LoginViewController.swift @@ -0,0 +1,82 @@ +// +// LoginViewController.swift +// assignment +// +// Created by 이경민 on 2022/04/06. +// + +import UIKit + +final class LoginViewController: UIViewController { + + // MARK: - IBOutlet + + @IBOutlet weak var emailTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var showPasswordButton: UIButton! + @IBOutlet weak var loginButton: UIButton! + + + // MARK: - LifeCycle + + override func viewDidLoad() { + super.viewDidLoad() + setUI() + setTextField() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + removeTextField() + } + + // MARK: - Function + + private func setUI() { + setButtonUI() + } + + private func setButtonUI() { + showPasswordButton.setImage(UIImage(systemName: "eye.fill"), for: .normal) + showPasswordButton.setImage(UIImage(systemName: "eye.slash.fill"), for: .selected) + loginButton.layer.cornerRadius = 10 + } + + private func setTextField() { + [emailTextField, passwordTextField].forEach { + $0?.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) + } + } + + private func removeTextField() { + [emailTextField, passwordTextField].forEach { + $0?.text?.removeAll() + } + } + + // MARK: - objc function + + @objc func textFieldDidChange(_ sender: UITextField) { + loginButton.isEnabled = emailTextField.hasText && passwordTextField.hasText + } + + // MARK: - IBAction + + @IBAction func showPasswordButtonDidTap(_ sender: Any) { + showPasswordButton.isSelected.toggle() + passwordTextField.isSecureTextEntry.toggle() + } + + @IBAction func completeButtonDidTap(_ sender: Any) { + guard let completeVC = UIStoryboard(name: "Complete", bundle: nil).instantiateViewController(withIdentifier: "CompleteViewController") as? CompleteViewController else { return } + completeVC.modalTransitionStyle = .crossDissolve + completeVC.modalPresentationStyle = .fullScreen + completeVC.userName = emailTextField.text ?? "" + self.present(completeVC, animated: true) + } + + @IBAction func joinButtonDidTap(_ sender: Any) { + guard let joinNameVC = UIStoryboard(name: "Join", bundle: nil).instantiateViewController(withIdentifier: "JoinNameViewController") as? JoinNameViewController else { return } + self.navigationController?.pushViewController(joinNameVC, animated: true) + } +} diff --git a/assignment/assignment/ViewController.swift b/assignment/assignment/Scene/ViewController.swift similarity index 100% rename from assignment/assignment/ViewController.swift rename to assignment/assignment/Scene/ViewController.swift diff --git a/assignment/assignment/AppDelegate.swift b/assignment/assignment/Supports/AppDelegate.swift similarity index 100% rename from assignment/assignment/AppDelegate.swift rename to assignment/assignment/Supports/AppDelegate.swift diff --git a/assignment/assignment/Assets.xcassets/AccentColor.colorset/Contents.json b/assignment/assignment/Supports/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from assignment/assignment/Assets.xcassets/AccentColor.colorset/Contents.json rename to assignment/assignment/Supports/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/assignment/assignment/Assets.xcassets/AppIcon.appiconset/Contents.json b/assignment/assignment/Supports/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from assignment/assignment/Assets.xcassets/AppIcon.appiconset/Contents.json rename to assignment/assignment/Supports/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/assignment/assignment/Assets.xcassets/Contents.json b/assignment/assignment/Supports/Assets.xcassets/Contents.json similarity index 100% rename from assignment/assignment/Assets.xcassets/Contents.json rename to assignment/assignment/Supports/Assets.xcassets/Contents.json diff --git a/assignment/assignment/Base.lproj/LaunchScreen.storyboard b/assignment/assignment/Supports/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from assignment/assignment/Base.lproj/LaunchScreen.storyboard rename to assignment/assignment/Supports/Base.lproj/LaunchScreen.storyboard diff --git a/assignment/assignment/SceneDelegate.swift b/assignment/assignment/Supports/SceneDelegate.swift similarity index 100% rename from assignment/assignment/SceneDelegate.swift rename to assignment/assignment/Supports/SceneDelegate.swift