From cdec552811fd330057f17d896023d567c3db5f71 Mon Sep 17 00:00:00 2001 From: gme_2 Date: Mon, 10 Sep 2018 14:03:30 +0900 Subject: [PATCH] splash screen recreated in module --- GMERemittance/AppDelegate.swift | 6 +- .../View/SplashScreen.storyboard | 182 ++++++++++++++++-- .../View/SplashScreenViewController.swift | 117 ++++++++++- 3 files changed, 291 insertions(+), 14 deletions(-) diff --git a/GMERemittance/AppDelegate.swift b/GMERemittance/AppDelegate.swift index 04a941a8..e9fd1c56 100644 --- a/GMERemittance/AppDelegate.swift +++ b/GMERemittance/AppDelegate.swift @@ -74,8 +74,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.window?.rootViewController = mainWireFrame?.getMainView() }else { // go to splashscreen - let splasScreen = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "_SplashScreenViewController") as! _SplashScreenViewController - self.window?.rootViewController = splasScreen + let splashWireframe = SplashScreenWireframe() + self.window?.rootViewController = splashWireframe.getMainView() +// let splasScreen = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "_SplashScreenViewController") as! _SplashScreenViewController +// self.window?.rootViewController = splasScreen } } diff --git a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard index a6cae57c..730ea500 100644 --- a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard +++ b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreen.storyboard @@ -1,31 +1,191 @@ - + - + + + + + + + SanFranciscoDisplay-Regular + + + SanFranciscoDisplay-Semibold + + - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + diff --git a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift index a2d7ca23..35002190 100644 --- a/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift +++ b/GMERemittance/Module/SplashScreen/User Interface/View/SplashScreenViewController.swift @@ -11,10 +11,37 @@ import UIKit class SplashScreenViewController: UIViewController { // MARK: IBOutlets + @IBOutlet weak var imageViewDotCenter: UIImageView! + @IBOutlet weak var imageViewDotLeft: UIImageView! + @IBOutlet weak var imageViewDotRight: UIImageView! + @IBOutlet weak var imageViewHomeLogo: UIImageView! + @IBOutlet weak var labelHomeDescription: UILabel! + + @IBOutlet weak var constraintLeft: NSLayoutConstraint! + @IBOutlet weak var constraintRight: NSLayoutConstraint! + + @IBOutlet weak var buttonLogin: UIButton! + @IBOutlet weak var buttonSignUp: UIButton! // MARK: Properties + + var counter: Int = 0 + + let imageDotSelected = UIImage(named: "dotSelected") + let imageDotUnselected = UIImage(named: "dotUnselected") + + let imageFirst = UIImage(named: "ic_splashFirstScreen") + let imageSecond = UIImage(named: "ic_splashSecondScreen") + let imageThird = UIImage(named: "ic_splashThirdScreen") + + let descriptionFirst = "Hassle free money transfer to your loved ones" + let descriptionSecond = "Connect to local community" + let descriptionThird = "Earn reward points and get surprise gifts" + + + var presenter: SplashScreenModuleInterface? @@ -27,11 +54,99 @@ class SplashScreenViewController: UIViewController { // MARK: IBActions + @IBAction func login(_ sender: UIButton) { + print("login") + } + + + @IBAction func register(_ sender: UIButton) { + print("register") + } + // MARK: Other Functions private func setup() { // all setup should be done here - + setUpButtons() + + imageViewDotLeft.image = UIImage(named: "dotSelected") + let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:))) + let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(_SplashScreenViewController.handleSwipes(_:))) + + leftSwipe.direction = .left + rightSwipe.direction = .right + + view.addGestureRecognizer(leftSwipe) + view.addGestureRecognizer(rightSwipe) + + Timer.scheduledTimer(timeInterval: 2, target: self, selector: #selector(_SplashScreenViewController.updateImage), userInfo: nil, repeats: true) + } + + @objc func handleSwipes(_ sender: UISwipeGestureRecognizer) { + if (sender.direction == .right) { + counter = counter - 1 + if counter < 0 { + counter = 2 + } + } + + if (sender.direction == .left) { + counter = counter + 1 + if counter > 2 { + counter = 0 + } + } + setImageandLabels() + } + + @objc func updateImage() { + counter += 1 + if counter > 2 { + counter = 0 + } + setImageandLabels() + } + + func setImageandLabels() { + + imageViewDotLeft.image = imageDotUnselected + imageViewDotCenter.image = imageDotUnselected + imageViewDotRight.image = imageDotUnselected + + switch counter { + case 0: + constraintLeft.constant = 34 + constraintRight.constant = 33 + imageViewDotLeft.image = imageDotSelected + imageViewHomeLogo.image = imageFirst + labelHomeDescription.text = descriptionFirst + case 1: + constraintLeft.constant = 34 + constraintRight.constant = 33 + imageViewDotCenter.image = imageDotSelected + imageViewHomeLogo.image = imageSecond + labelHomeDescription.text = descriptionSecond + case 2: + constraintLeft.constant = 61 + constraintRight.constant = 60 + imageViewDotRight.image = imageDotSelected + imageViewHomeLogo.image = imageThird + labelHomeDescription.text = descriptionThird + default: + return + } + } + + func setUpButtons() { + buttonSignUp.layer.cornerRadius = 25 + buttonLogin.backgroundColor = .clear + buttonLogin.layer.cornerRadius = 25 + buttonLogin.layer.borderWidth = 1 + buttonLogin.layer.borderColor = UIColor.white.cgColor + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() } }