From 6a436275d3cdfaa56eafe5c5082c896e70002bc2 Mon Sep 17 00:00:00 2001 From: kim-seonwoo Date: Tue, 9 Jan 2024 21:38:39 +0900 Subject: [PATCH] =?UTF-8?q?[Add/#40]=20Splash=20-=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj | 40 ++++++++++++++++++ .../HMH_iOS/Application/SceneDelegate.swift | 41 ++++++++++++++++--- .../SplashViewController.swift | 16 ++++++++ 3 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 HMH_iOS/HMH_iOS/Presentation/Splash/ViewControllers/SplashViewController.swift diff --git a/HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj b/HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj index a744c84..7e06b2e 100644 --- a/HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj +++ b/HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj @@ -32,6 +32,8 @@ 0BA193B92B4D4097007E3F9C /* SignInModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BA193B82B4D4097007E3F9C /* SignInModel.swift */; }; 0BC0EBD22B493B6B003EF5D4 /* OnboardingProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC0EBD12B493B6B003EF5D4 /* OnboardingProgressView.swift */; }; 0BC0EBD42B494459003EF5D4 /* OnboardingSwipeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC0EBD32B494459003EF5D4 /* OnboardingSwipeView.swift */; }; + 0BD98DB92B4D671600E35188 /* SplashViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BD98DB82B4D671600E35188 /* SplashViewController.swift */; }; + 0BD98DBE2B4D6AB700E35188 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BD98DBD2B4D6AB700E35188 /* LoginViewController.swift */; }; 17314F7F2B485E150089A551 /* CustomAlertButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F7E2B485E150089A551 /* CustomAlertButton.swift */; }; 17314F832B486BEC0089A551 /* AlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F822B486BEC0089A551 /* AlertViewController.swift */; }; 17314F852B497FDE0089A551 /* HMHLogoutAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17314F842B497FDE0089A551 /* HMHLogoutAlert.swift */; }; @@ -171,6 +173,8 @@ 0BA193B82B4D4097007E3F9C /* SignInModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInModel.swift; sourceTree = ""; }; 0BC0EBD12B493B6B003EF5D4 /* OnboardingProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingProgressView.swift; sourceTree = ""; }; 0BC0EBD32B494459003EF5D4 /* OnboardingSwipeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingSwipeView.swift; sourceTree = ""; }; + 0BD98DB82B4D671600E35188 /* SplashViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashViewController.swift; sourceTree = ""; }; + 0BD98DBD2B4D6AB700E35188 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = ""; }; 17314F7E2B485E150089A551 /* CustomAlertButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertButton.swift; sourceTree = ""; }; 17314F822B486BEC0089A551 /* AlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertViewController.swift; sourceTree = ""; }; 17314F842B497FDE0089A551 /* HMHLogoutAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMHLogoutAlert.swift; sourceTree = ""; }; @@ -362,6 +366,8 @@ 0B67CCE72B369BE300582D54 /* Presentation */ = { isa = PBXGroup; children = ( + 0BD98DBA2B4D6A5A00E35188 /* Login */, + 0BD98DB72B4D670200E35188 /* Splash */, 3666C8842B47110800564874 /* CreateChallenge */, 174AF4842B447AB500450D07 /* MyPage */, 174AF4832B447A7A00450D07 /* Challenge */, @@ -568,6 +574,38 @@ path = Models; sourceTree = ""; }; + 0BD98DB72B4D670200E35188 /* Splash */ = { + isa = PBXGroup; + children = ( + 0BD98DBB2B4D6A6D00E35188 /* ViewControllers */, + ); + path = Splash; + sourceTree = ""; + }; + 0BD98DBA2B4D6A5A00E35188 /* Login */ = { + isa = PBXGroup; + children = ( + 0BD98DBC2B4D6A8800E35188 /* ViewControllers */, + ); + path = Login; + sourceTree = ""; + }; + 0BD98DBB2B4D6A6D00E35188 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 0BD98DB82B4D671600E35188 /* SplashViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; + 0BD98DBC2B4D6A8800E35188 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 0BD98DBD2B4D6AB700E35188 /* LoginViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; 17314F7D2B485DCF0089A551 /* CustomAlert */ = { isa = PBXGroup; children = ( @@ -958,6 +996,8 @@ 36A3D9BE2B409BCC007EA272 /* Color.swift in Sources */, 0B8A89B52B369F0100688BA6 /* B.swift in Sources */, 174AF49C2B447D0700450D07 /* ChallengeViewController.swift in Sources */, + 0BD98DB92B4D671600E35188 /* SplashViewController.swift in Sources */, + 0BD98DBE2B4D6AB700E35188 /* LoginViewController.swift in Sources */, 17314F892B49A8B60089A551 /* AlertDelegate.swift in Sources */, 0B78174E2B4BD96D0078E925 /* OnboardingBaseViewControllers.swift in Sources */, 0B8A89B12B369E4C00688BA6 /* HomeView.swift in Sources */, diff --git a/HMH_iOS/HMH_iOS/Application/SceneDelegate.swift b/HMH_iOS/HMH_iOS/Application/SceneDelegate.swift index 5ff73d9..629882e 100644 --- a/HMH_iOS/HMH_iOS/Application/SceneDelegate.swift +++ b/HMH_iOS/HMH_iOS/Application/SceneDelegate.swift @@ -13,12 +13,41 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - guard let windowScene = (scene as? UIWindowScene) else { return } - window = UIWindow(windowScene: windowScene) - window?.rootViewController = UINavigationController(rootViewController: TabBarController()) - if let navigationController = window?.rootViewController as? UINavigationController { - navigationController.isNavigationBarHidden = true + guard let windowScene = (scene as? UIWindowScene) else { return } + + let window = UIWindow(windowScene: windowScene) + self.window = window + + let splashViewController = SplashViewController() + window.rootViewController = splashViewController + window.makeKeyAndVisible() + + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + DispatchQueue.main.async{ + showLoginViewController() } - window?.makeKeyAndVisible() } + + func showTabBarViewController() { + let tabBarViewController = TabBarController() + navigateTo(viewController: tabBarViewController) + } + + func showLoginViewController() { + let loginViewController = LoginViewController() + navigateTo(viewController: loginViewController) + } + + func navigateTo(viewController: UIViewController) { + DispatchQueue.main.async { + if let navigationController = self.window?.rootViewController as? UINavigationController { + navigationController.pushViewController(viewController, animated: true) + } else { + let navigationController = UINavigationController(rootViewController: viewController) + self.window?.rootViewController = navigationController + self.window?.makeKeyAndVisible() + } + } + } + } } diff --git a/HMH_iOS/HMH_iOS/Presentation/Splash/ViewControllers/SplashViewController.swift b/HMH_iOS/HMH_iOS/Presentation/Splash/ViewControllers/SplashViewController.swift new file mode 100644 index 0000000..c0839d4 --- /dev/null +++ b/HMH_iOS/HMH_iOS/Presentation/Splash/ViewControllers/SplashViewController.swift @@ -0,0 +1,16 @@ +// +// SplashViewController.swift +// HMH_iOS +// +// Created by Seonwoo Kim on 1/9/24. +// + +import UIKit + +final class SplashViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .systemYellow + } +}