Skip to content

Commit

Permalink
[refactor] :refactor: splashVC refactor (#107)
Browse files Browse the repository at this point in the history
함수 간결화 및 불필요한 주석 삭제
factory를 통한 VC 인스턴스 생성 채택
  • Loading branch information
i-colours-u committed Feb 8, 2022
1 parent 4a4efe7 commit 818db70
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ iOSInjectionProject/
*.xlsx

Pods/
BeMyPlan/GoogleService-Info.plist
BeMyPlan/Info.plist
BeMyPlan/Global/Network/Config.swift

BeMyPlan/BeMyPlan/GoogleService-Info.plist
BeMyPlan/BeMyPlan/Info.plist
BeMyPlan/BeMyPlan/Global/Network/Config.swift

### Xcode Patch ###
*.xcodeproj/*
Expand Down
9 changes: 7 additions & 2 deletions BeMyPlan/BeMyPlan/Coordinator/Factory/ModuleFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

protocol ModuleFactroyProtocol {
protocol ModuleFactoryProtocol {

// MARK: - Splash
func instantiateSplashVC() -> SplashVC
Expand All @@ -17,6 +17,7 @@ protocol ModuleFactroyProtocol {
func instantiateSignupVC() -> SignUpVC

// MARK: - BaseTab
func instantiateBaseNC() -> BaseNC
func instantiateBaseVC() -> BaseVC

// MARK: - Home
Expand All @@ -43,7 +44,7 @@ protocol ModuleFactroyProtocol {
func instantiatePlanListVC() -> TravelSpotDetailVC
}

class ModuleFactory: ModuleFactroyProtocol{
class ModuleFactory: ModuleFactoryProtocol{

static func resolve() -> ModuleFactory {
return ModuleFactory()
Expand All @@ -64,6 +65,10 @@ class ModuleFactory: ModuleFactroyProtocol{
}

// MARK: - Base Tap

func instantiateBaseNC() -> BaseNC {
return BaseNC.controllerFromStoryboard(.base)
}

func instantiateBaseVC() -> BaseVC {
return BaseVC.controllerFromStoryboard(.base)
Expand Down
23 changes: 7 additions & 16 deletions BeMyPlan/BeMyPlan/Screen/Splash/SplashVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import UIKit
class SplashVC: UIViewController {

// MARK: - Vars & Lets Part

var isLoginComplete = false
private let factory: ModuleFactoryProtocol = ModuleFactory.resolve()

// MARK: - UI Component Part
@IBOutlet var splashIconNoTitle: UIImageView!
Expand All @@ -23,9 +23,6 @@ class SplashVC: UIViewController {
super.viewDidLoad()
startSplash()
}

// MARK: - IBAction Part

// MARK: - Custom Method Part

private func startSplash(){
Expand All @@ -46,21 +43,15 @@ class SplashVC: UIViewController {
}

private func moveBaseVC(){
guard let baseVC = UIStoryboard.list(.base).instantiateViewController(withIdentifier: BaseNC.className) as? BaseNC else {return}
baseVC.modalPresentationStyle = .fullScreen
self.present(baseVC, animated: false, completion: nil)
let baseNC = factory.instantiateBaseNC()
baseNC.modalPresentationStyle = .fullScreen
self.present(baseNC, animated: false, completion: nil)
}

private func moveLoginVC(){
guard let loginVC = UIStoryboard.list(.login).instantiateViewController(withIdentifier: LoginNC.className) as? LoginNC else {return}
loginVC
.modalPresentationStyle = .fullScreen

let loginVC = factory.instantiateLoginVC()
loginVC.modalPresentationStyle = .fullScreen
self.present(loginVC, animated: false, completion: nil)

}

// MARK: - @objc Function Part


}
// MARK: - Extension Part

0 comments on commit 818db70

Please sign in to comment.