Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.80 KB | None | 0 0
  1.   func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
  2.        
  3.         if userActivity.activityType == "com.azamsharp.HotCoffee.activity-type" {
  4.            
  5.             if let userInfo = userActivity.userInfo,
  6.                 let coffeeCupSize = userInfo["CoffeeCupSize"] as? Int
  7.                 {
  8.                
  9.                     guard let vc = window?.rootViewController as? ViewController else {
  10.                         fatalError("No root view controller found")
  11.                     }
  12.                    
  13.                     vc.coffeeSizeSegmentedControl.selectedSegmentIndex = coffeeCupSize
  14.                    
  15.             }
  16.         }
  17.        
  18.         return true
  19.        
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement