From 30ac3520108ccb9f5cdb3b452a8d4ecdc927fd39 Mon Sep 17 00:00:00 2001 From: heerucan Date: Thu, 7 Oct 2021 04:19:39 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8[FEAT]=20LoginVC=20UI=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84(#2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 12 +- .../Extension/UIColor + Extension.swift | 14 ++ .../Extension/UITextField + Extension.swift | 2 +- .../Resource/Support/SceneDelegate.swift | 2 +- .../Source/View Controller/LoginVC.swift | 137 ++++++++++++++++++ .../View Controller/ViewController.swift | 29 ---- 6 files changed, 161 insertions(+), 35 deletions(-) create mode 100644 Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UIColor + Extension.swift create mode 100644 Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/LoginVC.swift delete mode 100644 Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/ViewController.swift diff --git a/Sopt29th-Assignment/Sopt29th-Assignment.xcodeproj/project.pbxproj b/Sopt29th-Assignment/Sopt29th-Assignment.xcodeproj/project.pbxproj index 76d663f..c590dee 100644 --- a/Sopt29th-Assignment/Sopt29th-Assignment.xcodeproj/project.pbxproj +++ b/Sopt29th-Assignment/Sopt29th-Assignment.xcodeproj/project.pbxproj @@ -9,11 +9,12 @@ /* Begin PBXBuildFile section */ 5B2B4621270B6CC90074B585 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4620270B6CC90074B585 /* AppDelegate.swift */; }; 5B2B4623270B6CC90074B585 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4622270B6CC90074B585 /* SceneDelegate.swift */; }; - 5B2B4625270B6CC90074B585 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4624270B6CC90074B585 /* ViewController.swift */; }; + 5B2B4625270B6CC90074B585 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4624270B6CC90074B585 /* LoginVC.swift */; }; 5B2B462A270B6CCC0074B585 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B2B4629270B6CCC0074B585 /* Assets.xcassets */; }; 5B2B462D270B6CCC0074B585 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B2B462B270B6CCC0074B585 /* LaunchScreen.storyboard */; }; 5B2B463B270B744E0074B585 /* UIView + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B463A270B744E0074B585 /* UIView + Extension.swift */; }; 5B324483270E183700CD52D6 /* UITextField + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B324482270E183700CD52D6 /* UITextField + Extension.swift */; }; + 5B324485270E1EDC00CD52D6 /* UIColor + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */; }; A1DB3182B180D8A44F60F25F /* Pods_Sopt29th_Assignment.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F1FA1544DF3043971FE0FA5 /* Pods_Sopt29th_Assignment.framework */; }; /* End PBXBuildFile section */ @@ -22,12 +23,13 @@ 5B2B461D270B6CC90074B585 /* Sopt29th-Assignment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Sopt29th-Assignment.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 5B2B4620270B6CC90074B585 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 5B2B4622270B6CC90074B585 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - 5B2B4624270B6CC90074B585 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 5B2B4624270B6CC90074B585 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = ""; }; 5B2B4629270B6CCC0074B585 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 5B2B462C270B6CCC0074B585 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 5B2B462E270B6CCC0074B585 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 5B2B463A270B744E0074B585 /* UIView + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView + Extension.swift"; sourceTree = ""; }; 5B324482270E183700CD52D6 /* UITextField + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField + Extension.swift"; sourceTree = ""; }; + 5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor + Extension.swift"; sourceTree = ""; }; 5F1FA1544DF3043971FE0FA5 /* Pods_Sopt29th_Assignment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sopt29th_Assignment.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CF5F82FDB012770AC2B155F7 /* Pods-Sopt29th-Assignment.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sopt29th-Assignment.release.xcconfig"; path = "Target Support Files/Pods-Sopt29th-Assignment/Pods-Sopt29th-Assignment.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -120,7 +122,7 @@ 5B2B4638270B6D490074B585 /* View Controller */ = { isa = PBXGroup; children = ( - 5B2B4624270B6CC90074B585 /* ViewController.swift */, + 5B2B4624270B6CC90074B585 /* LoginVC.swift */, ); path = "View Controller"; sourceTree = ""; @@ -130,6 +132,7 @@ children = ( 5B2B463A270B744E0074B585 /* UIView + Extension.swift */, 5B324482270E183700CD52D6 /* UITextField + Extension.swift */, + 5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */, ); path = Extension; sourceTree = ""; @@ -258,7 +261,8 @@ files = ( 5B2B463B270B744E0074B585 /* UIView + Extension.swift in Sources */, 5B324483270E183700CD52D6 /* UITextField + Extension.swift in Sources */, - 5B2B4625270B6CC90074B585 /* ViewController.swift in Sources */, + 5B2B4625270B6CC90074B585 /* LoginVC.swift in Sources */, + 5B324485270E1EDC00CD52D6 /* UIColor + Extension.swift in Sources */, 5B2B4621270B6CC90074B585 /* AppDelegate.swift in Sources */, 5B2B4623270B6CC90074B585 /* SceneDelegate.swift in Sources */, ); diff --git a/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UIColor + Extension.swift b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UIColor + Extension.swift new file mode 100644 index 0000000..06d6464 --- /dev/null +++ b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UIColor + Extension.swift @@ -0,0 +1,14 @@ +// +// UIColor + Extension.swift +// Sopt29th-Assignment +// +// Created by Thisisme Hi on 2021/10/07. +// + +import UIKit + +extension UIColor { + @nonobjc class var mainBlue: UIColor { + return UIColor(red: 66.0 / 255.0, green: 133.0 / 255.0, blue: 244.0 / 255.0, alpha: 1.0) + } +} diff --git a/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UITextField + Extension.swift b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UITextField + Extension.swift index ef246b0..276a705 100644 --- a/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UITextField + Extension.swift +++ b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Extension/UITextField + Extension.swift @@ -20,7 +20,7 @@ extension UITextField { self.font = .boldSystemFont(ofSize: 15) self.backgroundColor = .white self.borderStyle = .line - self.layer.borderWidth = 0.5 + self.layer.borderWidth = 2 self.layer.borderColor = UIColor.lightGray.cgColor self.layer.cornerRadius = 7 self.clipsToBounds = true diff --git a/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Support/SceneDelegate.swift b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Support/SceneDelegate.swift index 6fe5e8d..8f02997 100644 --- a/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Support/SceneDelegate.swift +++ b/Sopt29th-Assignment/Sopt29th-Assignment/Resource/Support/SceneDelegate.swift @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(frame: windowScene.coordinateSpace.bounds) window?.windowScene = windowScene - window?.rootViewController = ViewController() + window?.rootViewController = LoginVC() window?.makeKeyAndVisible() } diff --git a/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/LoginVC.swift b/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/LoginVC.swift new file mode 100644 index 0000000..e061cd8 --- /dev/null +++ b/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/LoginVC.swift @@ -0,0 +1,137 @@ +// +// LoginVC.swift +// Sopt29th-Assignment +// +// Created by Thisisme Hi on 2021/10/05. +// + +import UIKit +import SnapKit +import Then + +class LoginVC: UIViewController { + // MARK: - Properties + let logoLabel = UILabel().then { + $0.font = .boldSystemFont(ofSize: 50) + $0.textColor = .mainBlue + $0.text = "Google" + } + + let loginLabel = UILabel().then { + $0.font = .boldSystemFont(ofSize: 35) + $0.textColor = .black + $0.text = "로그인" + } + + let explainLabel = UILabel().then { + $0.font = .boldSystemFont(ofSize: 16) + $0.textColor = .lightGray + $0.numberOfLines = 0 + $0.textAlignment = .center + $0.text = "YouTube도 이동하며 계속하세요. 앱 및 Safari에서도 Google 서비스에 로그인됩니다." + } + + private lazy var fieldStackView = UIStackView().then { + $0.axis = .vertical + $0.alignment = .fill + $0.distribution = .fillEqually + $0.spacing = 20 + $0.addArrangedSubview(nameTextField) + $0.addArrangedSubview(emailTextField) + $0.addArrangedSubview(pwTextField) + } + + let nameTextField = UITextField().then { + $0.setTextField(placeholder: "이름을 입력해주세요", secure: false) + } + + let emailTextField = UITextField().then { + $0.setTextField(placeholder: "이메일 또는 휴대전화", secure: false) + } + + let pwTextField = UITextField().then { + $0.setTextField(placeholder: "비밀번호 입력", secure: true) + } + + lazy var signUpButton = UIButton().then { + $0.setTitle("계정만들기", for: .normal) + $0.setTitleColor(.mainBlue, for: .normal) + $0.setTitleColor(.white, for: .highlighted) + $0.titleLabel?.font = .boldSystemFont(ofSize: 16) + $0.addTarget(self, action: #selector(touchUpSignUpButton(_:)), for: .touchUpInside) + } + + lazy var signInButton = UIButton().then { + $0.setTitle("다음", for: .normal) + $0.setTitleColor(.white, for: .normal) + $0.titleLabel?.font = .boldSystemFont(ofSize: 18) + $0.backgroundColor = .mainBlue + $0.layer.cornerRadius = 10 + $0.addTarget(self, action: #selector(touchUpSignInButton(_:)), for: .touchUpInside) + } + + // MARK: - Lifecycle + override func viewDidLoad() { + super.viewDidLoad() + configUI() + setupAutoLayout() + } + + // MARK: - Custom Method + func configUI() { + view.backgroundColor = .white + } + + func setupAutoLayout() { + view.addSubviews([logoLabel, loginLabel, explainLabel, + fieldStackView, signUpButton, signInButton]) + + logoLabel.snp.makeConstraints { make in + make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).inset(20) + make.centerX.equalToSuperview() + } + + loginLabel.snp.makeConstraints { make in + make.top.equalTo(logoLabel.snp.bottom).offset(15) + make.centerX.equalToSuperview() + } + + explainLabel.snp.makeConstraints { make in + make.top.equalTo(loginLabel.snp.bottom).offset(35) + make.leading.trailing.equalToSuperview().inset(30) + make.centerX.equalToSuperview() + } + + nameTextField.snp.makeConstraints { make in + make.height.equalTo(60) + } + + fieldStackView.snp.makeConstraints { make in + make.top.equalTo(explainLabel.snp.bottom).offset(35) + make.leading.trailing.equalToSuperview().inset(30) + make.centerX.equalToSuperview() + } + + signUpButton.snp.makeConstraints { make in + make.top.equalTo(fieldStackView.snp.bottom).offset(110) + make.leading.equalToSuperview().inset(30) + } + + signInButton.snp.makeConstraints { make in + make.trailing.equalToSuperview().inset(30) + make.centerY.equalTo(signUpButton.snp.centerY) + make.width.equalTo(80) + make.height.equalTo(50) + } + } + + // MARK: - @objc + @objc func touchUpSignUpButton(_ sender: UIButton) { + + } + + @objc func touchUpSignInButton(_ sender: UIButton) { + + } +} + diff --git a/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/ViewController.swift b/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/ViewController.swift deleted file mode 100644 index c11a08b..0000000 --- a/Sopt29th-Assignment/Sopt29th-Assignment/Source/View Controller/ViewController.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// ViewController.swift -// Sopt29th-Assignment -// -// Created by Thisisme Hi on 2021/10/05. -// - -import UIKit - -class ViewController: UIViewController { - // MARK: - Properties - - // MARK: - Lifecycle - override func viewDidLoad() { - super.viewDidLoad() - configUI() - setupAutoLayout() - } - - // MARK: - Custom Method - func configUI() { - view.backgroundColor = .white - } - - func setupAutoLayout() { - - } -} -