Skip to content

Instantly share code, notes, and snippets.

@russell-archer
Last active September 3, 2018 23:58
Show Gist options
  • Save russell-archer/bf5f9f2f5fa273be32ce1c715788b64a to your computer and use it in GitHub Desktop.
Save russell-archer/bf5f9f2f5fa273be32ce1c715788b64a to your computer and use it in GitHub Desktop.
Demo of Siri shortcuts for iOS 12 using NSUserActivity
//
// 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