IntentHandler.swift 1018 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // IntentHandler.swift
  3. // WidgetDashboardIntentHandler
  4. //
  5. // Created by Marino Faggiana on 08/10/22.
  6. // Copyright © 2022 Marino Faggiana. All rights reserved.
  7. //
  8. import Intents
  9. import RealmSwift
  10. class IntentHandler: INExtension, DashboardIntentHandling {
  11. override func handler(for intent: INIntent) -> Any {
  12. // This is the default implementation. If you want different objects to handle different intents,
  13. // you can override this and return the handler you want for that particular intent.
  14. guard let account = NCManageDatabase.shared.getActiveAccount() else {
  15. return self
  16. }
  17. return self
  18. }
  19. func provideCategoryOptionsCollection(for intent: DashboardIntentHandling, with completion: @escaping (INObjectCollection<Applications>?, Error?) -> Void) {
  20. let eventCategory = Applications(identifier: "ciao", display: "ciao")
  21. let collection = INObjectCollection(items: [eventCategory])
  22. completion(collection, nil)
  23. }
  24. }