Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. private func donate() {
  2.  
  3. let orderActivity = NSUserActivity(activityType: "com.azamsharp.HotCoffee.activity-type")
  4.  
  5. orderActivity.isEligibleForSearch = true
  6. orderActivity.isEligibleForPrediction = true
  7. orderActivity.title = "Regular Hot Coffee"
  8. orderActivity.suggestedInvocationPhrase = "Coffee Time"
  9.  
  10. let attributes = CSSearchableItemAttributeSet(itemContentType: kUTTypeItem as String)
  11.  
  12. attributes.contentDescription = "Get it while its hot!"
  13.  
  14. if let thumbnailImage = UIImage(named: "coffee-thumbnail-image") {
  15. attributes.thumbnailData = thumbnailImage.pngData()
  16. }
  17.  
  18. orderActivity.contentAttributeSet = attributes
  19. self.userActivity = orderActivity
  20.  
  21. self.userActivity?.becomeCurrent()
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement