3D touch to search
This commit is contained in:
parent
563156b0a4
commit
97056ab91c
3 changed files with 36 additions and 0 deletions
|
|
@ -18,8 +18,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
|
||||
print(shortcutItem.type)
|
||||
if shortcutItem.type == "me.mssun.pass.search" {
|
||||
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func postSearchNotification() {
|
||||
NotificationCenter.default.post(Notification(name: Notification.Name("search")))
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
|
||||
if shortcutItem.type == "me.mssun.pass.search" {
|
||||
let tabBarController = self.window!.rootViewController as! UITabBarController
|
||||
tabBarController.selectedIndex = 0
|
||||
let navigationController = tabBarController.selectedViewController as! UINavigationController
|
||||
navigationController.popToRootViewController(animated: false)
|
||||
self.perform(#selector(postSearchNotification), with: nil, afterDelay: 0.4)
|
||||
}
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue