diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index bf9a8f14..daad92f4 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 */; }; @@ -98,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 = ""; }; @@ -137,6 +137,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 = ""; }; @@ -530,7 +531,7 @@ CE6655C3295D837800C64E12 /* VC */ = { isa = PBXGroup; children = ( - CE6655C6295D83BD00C64E12 /* .gitkeep */, + CEC2A68629629B9B00160BF7 /* SignInVC.swift */, ); path = VC; sourceTree = ""; @@ -741,6 +742,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 */, @@ -931,6 +933,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; @@ -958,6 +961,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/Global/Supports/Base.lproj/LaunchScreen.storyboard b/Runnect-iOS/Runnect-iOS/Global/Supports/Base.lproj/LaunchScreen.storyboard index 865e9329..eb157876 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/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 new file mode 100644 index 00000000..0c0fd5f0 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/SignIn/VC/SignInVC.swift @@ -0,0 +1,126 @@ +// +// SignInVC.swift +// Runnect-iOS +// +// Created by sejin on 2023/01/02. +// + +import UIKit + +final class SignInVC: UIViewController { + + // MARK: - Properties + + private let nicknameMaxLength = 7 + + // 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 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) + + // MARK: - View Life Cycle + + override func viewDidLoad() { + 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 + } +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift index 14005a43..e98345e0 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/Splash/VC/SplashVC.swift @@ -7,9 +7,65 @@ import UIKit -class SplashVC: UIViewController { +import SnapKit +import Then +final class SplashVC: UIViewController { + + // MARK: - UI Components + + 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.1) { + 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) + } } }