Last active
September 3, 2018 23:58
-
-
Save russell-archer/bf5f9f2f5fa273be32ce1c715788b64a to your computer and use it in GitHub Desktop.
Demo of Siri shortcuts for iOS 12 using NSUserActivity
This file contains hidden or 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
// | |
// AppDelegate.swift | |
// PicSearch | |
// | |
// Created by Russell Archer on 22/08/2018. | |
// Copyright © 2018 Russell Archer. All rights reserved. | |
// | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | |
let viewController = window?.rootViewController as! ViewController | |
if userActivity.activityType == "com.rarcher.PicSearch.showPic" { | |
viewController.showPic() | |
return true // Return true if you handle the shortcut | |
} | |
return false | |
} | |
: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment