From 2ec2220f1d18da48d037e6d4669ffa3792132a52 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Mon, 2 Jan 2023 14:04:21 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Feat]=20#10=20-=20SplashVC=20UI=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 4 ++ .../Base.lproj/LaunchScreen.storyboard | 36 ++++++++++-- .../Global/Supports/SceneDelegate.swift | 2 +- .../Presentation/SignIn/VC/SignInVC.swift | 18 ++++++ .../Presentation/Splash/VC/SplashVC.swift | 56 ++++++++++++++++++- 5 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index bf9a8f14..df918d17 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -63,6 +63,7 @@ CE665612295D92E400C64E12 /* UserDefaultWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE665611295D92E400C64E12 /* UserDefaultWrapper.swift */; }; CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = CE665614295D989A00C64E12 /* .swiftlint.yml */; }; CEC2A6852961F92C00160BF7 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A6842961F92C00160BF7 /* CustomButton.swift */; }; + CEC2A68729629B9B00160BF7 /* SignInVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A68629629B9B00160BF7 /* SignInVC.swift */; }; CEEC6B3A2961C4F300D00E1E /* CourseDrawingHomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEC6B392961C4F300D00E1E /* CourseDrawingHomeVC.swift */; }; CEEC6B3C2961C51A00D00E1E /* CourseStorageVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEC6B3B2961C51A00D00E1E /* CourseStorageVC.swift */; }; CEEC6B3E2961C53700D00E1E /* CourseDiscoveryVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEC6B3D2961C53700D00E1E /* CourseDiscoveryVC.swift */; }; @@ -137,6 +138,7 @@ CE665611295D92E400C64E12 /* UserDefaultWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultWrapper.swift; sourceTree = ""; }; CE665614295D989A00C64E12 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = ""; }; CEC2A6842961F92C00160BF7 /* CustomButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = ""; }; + CEC2A68629629B9B00160BF7 /* SignInVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInVC.swift; sourceTree = ""; }; CEEC6B392961C4F300D00E1E /* CourseDrawingHomeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDrawingHomeVC.swift; sourceTree = ""; }; CEEC6B3B2961C51A00D00E1E /* CourseStorageVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseStorageVC.swift; sourceTree = ""; }; CEEC6B3D2961C53700D00E1E /* CourseDiscoveryVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDiscoveryVC.swift; sourceTree = ""; }; @@ -531,6 +533,7 @@ isa = PBXGroup; children = ( CE6655C6295D83BD00C64E12 /* .gitkeep */, + CEC2A68629629B9B00160BF7 /* SignInVC.swift */, ); path = VC; sourceTree = ""; @@ -741,6 +744,7 @@ files = ( CE665604295D91B100C64E12 /* makeAlert.swift in Sources */, CE6655EA295D88B200C64E12 /* UITabBar+.swift in Sources */, + CEC2A68729629B9B00160BF7 /* SignInVC.swift in Sources */, CE665602295D918000C64E12 /* JsonCoder.swift in Sources */, CE4545CD295D7AF4003201E1 /* TaBarController.swift in Sources */, CE6655F4295D898400C64E12 /* UIViewController+.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard b/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard index 865e9329..839845e3 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,11 @@ - - + + + - + + + @@ -11,10 +14,26 @@ - + - + + + + + + + + + + + + + + + + + @@ -22,4 +41,11 @@ + + + + + + + diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift index b1a5c3a4..ac34efc3 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) - window.rootViewController = TabBarController() + window.rootViewController = UINavigationController(rootViewController: SplashVC()) self.window = window window.makeKeyAndVisible() } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift new file mode 100644 index 00000000..36b2f8cf --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift @@ -0,0 +1,18 @@ +// +// SignInVC.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/02. +// + +import UIKit + +final class SignInVC: UIViewController { + + // MARK: - View Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .red + } +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift index 14005a43..da8cc398 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift @@ -7,9 +7,63 @@ import UIKit -class SplashVC: UIViewController { +import SnapKit +import Then +final class SplashVC: UIViewController { + + private let backgroundImageView = UIImageView().then { + $0.image = ImageLiterals.imgBackground + $0.contentMode = .scaleAspectFill + } + + private let logoImageView = UIImageView().then { + $0.image = ImageLiterals.imgLogo + $0.contentMode = .scaleAspectFill + } + + // MARK: - View Life Cycle + override func viewDidLoad() { super.viewDidLoad() + self.setUI() + self.setNavigationBar() + self.setLayout() + self.pushToSignInView() + } +} + +// MARK: - Methods + +extension SplashVC { + private func pushToSignInView() { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + let signInVC = SignInVC() + self.navigationController?.pushViewController(signInVC, animated: true) + } + } +} + +// MARK: - UI & Layout + +extension SplashVC { + private func setUI() { + view.backgroundColor = .m1 + } + + private func setNavigationBar() { + self.navigationController?.isNavigationBarHidden = true + } + + private func setLayout() { + view.addSubviews(backgroundImageView, logoImageView) + + backgroundImageView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + logoImageView.snp.makeConstraints { make in + make.center.equalTo(view.safeAreaLayoutGuide) + } } } From e5ed95f997b56068159b8d7a29781aa551bcedf9 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Mon, 2 Jan 2023 14:11:16 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[Chore]=20#10=20-=20SplashVC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20w1=20=EC=BB=AC=EB=9F=AC=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B0=EB=9F=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj | 2 ++ Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift | 4 ++++ Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index df918d17..ea6d3cfc 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -935,6 +935,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 9K86FQHDLU; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Runnect-iOS/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -962,6 +963,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = 9K86FQHDLU; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Runnect-iOS/Info.plist"; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; diff --git a/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift b/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift index 9cfdbd79..0fc2614a 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift @@ -8,6 +8,10 @@ import UIKit extension UIColor { + static var w1: UIColor { + return UIColor(hex: "#ffffff") + } + static var g1: UIColor { return UIColor(hex: "#171717") } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift index da8cc398..e98345e0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift @@ -12,6 +12,8 @@ import Then final class SplashVC: UIViewController { + // MARK: - UI Components + private let backgroundImageView = UIImageView().then { $0.image = ImageLiterals.imgBackground $0.contentMode = .scaleAspectFill @@ -37,7 +39,7 @@ final class SplashVC: UIViewController { extension SplashVC { private func pushToSignInView() { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { let signInVC = SignInVC() self.navigationController?.pushViewController(signInVC, animated: true) } From 6b6f6e8b83355506940d5c399af665cf67d1d6ab Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Mon, 2 Jan 2023 14:36:31 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[Feat]=20#10=20-=20SignInVC=20=EA=B8=B0?= =?UTF-8?q?=EC=B4=88=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 2 - .../Global/UIComponents/CustomButton.swift | 2 +- .../Presentation/SignIn/VC/.gitkeep | 0 .../Presentation/SignIn/VC/SignInVC.swift | 64 ++++++++++++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) delete mode 100644 Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/.gitkeep diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index ea6d3cfc..daad92f4 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -99,7 +99,6 @@ CE6655C0295D82F000C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C1295D82F700C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C5295D83B700C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; - CE6655C6295D83BD00C64E12 /* .gitkeep */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitkeep; sourceTree = ""; }; CE6655C7295D849F00C64E12 /* StringLiterals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringLiterals.swift; sourceTree = ""; }; CE6655C9295D84DD00C64E12 /* UserDefaultKeyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultKeyList.swift; sourceTree = ""; }; CE6655CC295D856300C64E12 /* KeyPathFindable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyPathFindable.swift; sourceTree = ""; }; @@ -532,7 +531,6 @@ CE6655C3295D837800C64E12 /* VC */ = { isa = PBXGroup; children = ( - CE6655C6295D83BD00C64E12 /* .gitkeep */, CEC2A68629629B9B00160BF7 /* SignInVC.swift */, ); path = VC; diff --git a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomButton.swift b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomButton.swift index d8e4a988..74eb3cbc 100644 --- a/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomButton.swift +++ b/Runnect-iOS/Runnect-iOS/Global/UIComponents/CustomButton.swift @@ -60,7 +60,7 @@ extension CustomButton { self.layer.cornerRadius = 10 self.setBackgroundColor(.m1, for: .normal) - self.setBackgroundColor(.g2, for: .disabled) + self.setBackgroundColor(.g3, for: .disabled) self.setAttributedTitle( NSAttributedString( string: title, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/.gitkeep b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift index 36b2f8cf..e31d4862 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift @@ -8,11 +8,73 @@ import UIKit final class SignInVC: UIViewController { + + // MARK: - UI Components + + private let directionLabel = UILabel().then { + let attributedString = NSMutableAttributedString(string: "RUNNECT", attributes: [.font: UIFont.h2, .foregroundColor: UIColor.m1]) + attributedString.append(NSAttributedString(string: "에서\n사용할 이름을 입력해주세요", attributes: [.font: UIFont.h2_2, .foregroundColor: UIColor.g1])) + $0.attributedText = attributedString + $0.numberOfLines = 2 + } + + private let personImageView = UIImageView().then { + $0.image = ImageLiterals.imgPerson + $0.backgroundColor = .w1 + $0.clipsToBounds = true + } + + private let nicknameTextField = UITextField().then { + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.alignment = .center + $0.attributedPlaceholder = NSAttributedString(string: "닉네임을 입력해주세요", attributes: [.font: UIFont.h5, .foregroundColor: UIColor.g3, .paragraphStyle: paragraphStyle]) + $0.textAlignment = .center + $0.layer.cornerRadius = 10 + $0.layer.borderWidth = 1 + $0.layer.borderColor = UIColor.g3.cgColor + } + + private let startButton = CustomButton(title: "시작하기").setEnabled(false) // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .red + self.setUI() + self.setLayout() + } +} + +// MARK: - UI & Layout + +extension SignInVC { + private func setUI() { + view.backgroundColor = .w1 + } + + private func setLayout() { + view.addSubviews(directionLabel, personImageView, nicknameTextField, startButton) + + directionLabel.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(60) + make.leading.equalTo(view.safeAreaLayoutGuide).inset(24) + } + + personImageView.snp.makeConstraints { make in + make.centerX.equalTo(view.safeAreaLayoutGuide) + make.top.equalTo(directionLabel.snp.bottom).offset(93) + } + + nicknameTextField.snp.makeConstraints { make in + make.top.equalTo(personImageView.snp.bottom).offset(34) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(30) + make.height.equalTo(44) + } + + startButton.snp.makeConstraints { make in + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(30) + make.bottom.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(44) + } } } From 2eeb0dcfd1b45c2594d9249df05ea85f80ce6936 Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Mon, 2 Jan 2023 14:55:21 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Feat]=20#10=20-=20=EB=8B=89=EB=84=A4?= =?UTF-8?q?=EC=9E=84=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EC=8B=9C=20UI=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base.lproj/LaunchScreen.storyboard | 2 +- .../Presentation/SignIn/VC/SignInVC.swift | 52 +++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard b/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard index 839845e3..eb157876 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard @@ -17,7 +17,7 @@ - + diff --git a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift index e31d4862..0c0fd5f0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift @@ -9,6 +9,10 @@ import UIKit final class SignInVC: UIViewController { + // MARK: - Properties + + private let nicknameMaxLength = 7 + // MARK: - UI Components private let directionLabel = UILabel().then { @@ -24,14 +28,17 @@ final class SignInVC: UIViewController { $0.clipsToBounds = true } - private let nicknameTextField = UITextField().then { + private lazy var nicknameTextField = UITextField().then { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = .center $0.attributedPlaceholder = NSAttributedString(string: "닉네임을 입력해주세요", attributes: [.font: UIFont.h5, .foregroundColor: UIColor.g3, .paragraphStyle: paragraphStyle]) + $0.font = .h5 + $0.textColor = .g1 $0.textAlignment = .center $0.layer.cornerRadius = 10 $0.layer.borderWidth = 1 $0.layer.borderColor = UIColor.g3.cgColor + $0.addTarget(self, action: #selector(textFieldTextDidChange), for: .editingChanged) } private let startButton = CustomButton(title: "시작하기").setEnabled(false) @@ -42,6 +49,36 @@ final class SignInVC: UIViewController { super.viewDidLoad() self.setUI() self.setLayout() + self.setDelegate() + } +} + +// MARK: - Methods + +extension SignInVC { + private func setDelegate() { + self.nicknameTextField.delegate = self + } + + private func changeTextFieldLayerColor(_ isEditing: Bool) { + nicknameTextField.layer.borderColor = isEditing ? UIColor.m1.cgColor : UIColor.g3.cgColor + } +} + +// MARK: - @objc Function + +extension SignInVC { + @objc private func textFieldTextDidChange() { + guard let text = nicknameTextField.text else { return } + + startButton.isEnabled = !text.isEmpty + changeTextFieldLayerColor(!text.isEmpty) + + if text.count > nicknameMaxLength { + let index = text.index(text.startIndex, offsetBy: nicknameMaxLength) + let newString = text[text.startIndex.. Bool { + textField.resignFirstResponder() + return true + } +}