mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-01-12 17:22:45 +08:00
24 lines
649 B
Swift
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)
|
|
}
|
|
}
|
|
}
|