Created
October 9, 2018 00:14
-
-
Save russell-archer/9a6e51c7a883338c437c235202127bc7 to your computer and use it in GitHub Desktop.
ShowRandomColor. Add support for the user tapping a shortcut
This file contains 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 | |
// ShowRandomColor | |
// | |
// Created by Russell Archer on 05/10/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 { | |
if userActivity.interaction?.intent is ShowRandomColorIntent { | |
let viewController = window?.rootViewController as! ViewController | |
viewController.setColor() | |
return true | |
} | |
return false | |
} | |
// Other methods not shown for brevity | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment