Created
October 18, 2018 18:08
-
-
Save AlexGladkov/f8d8d0c56bcfc08508b00f82eb8e6d1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SubscriptionsRouter.swift | |
// sddclient | |
// | |
// Created by Гладков Алексей on 10.04.18. | |
// Copyright © 2018 SDD LLC. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
class SubscriptionsRouter: RoutingLayer { | |
override func routeToScreen(with key: ScreenKey, data: Any?) { | |
var destinationVC: UIViewController? = nil | |
switch key { | |
case .call: | |
/****/ | |
break | |
case .device: | |
let storyboard = UIStoryboard(name: Storyboards.order.rawValue, bundle: nil) | |
destinationVC = storyboard.instantiateViewController(withIdentifier: ScreenKey.device.rawValue) | |
if let request = (data as? RequestBundle) { | |
let storyboard = UIStoryboard(name: Storyboards.order.rawValue, bundle: nil) | |
destinationVC = storyboard.instantiateViewController(withIdentifier: ScreenKey.device.rawValue) | |
if let destination = (destinationVC as? DeviceViewController) { | |
destination.request = request | |
} | |
} | |
break | |
case .email: | |
break | |
default: | |
break | |
} | |
guard let destination = destinationVC else { return } | |
guard let source = viewController else { return } | |
source.navigationController?.pushViewController(destination, animated: true) | |
} | |
override func presentScreen(with key: ScreenKey, data: Any?) { | |
switch key { | |
case .keyAdd: | |
let storyboard = UIStoryboard(name: Storyboards.logged.rawValue, bundle: nil) | |
let keyAddVC = storyboard.instantiateViewController(withIdentifier: ScreenKey.keyAdd.rawValue) as! KeyAddViewController | |
keyAddVC.keyAddExitListener = self | |
viewController?.present(keyAddVC, animated: true, completion: nil) | |
break | |
case .buy: | |
viewController?.tabBarController?.selectedIndex = 1 | |
break | |
default: | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment