Files
GitHawk/Classes/Systems/Route.swift
2018-02-26 22:23:36 -08:00

24 lines
649 B
Swift

//
// Navigation.swift
// Freetime
//
// Created by Rizwan on 26/02/18.
// Copyright © 2018 Ryan Nystrom. All rights reserved.
//
import Foundation
enum Route {
case tab(TabBarController.Tab)
case switchAccount(sessionIndex: Int?)
init?(shortcutItem: UIApplicationShortcutItem) {
guard let itemType = ShortcutHandler.Items(rawValue: shortcutItem.type) else { return nil }
switch itemType {
case .search: self = .tab(.search)
case .bookmarks: self = .tab(.bookmarks)
case .switchAccount: self = .switchAccount(sessionIndex: shortcutItem.userInfo?["sessionIndex"] as? Int)
}
}
}