NotificationController.swift


  1. import WatchKit
  2. import SwiftUI
  3. import UserNotifications
  4. class NotificationController: WKUserNotificationHostingController<NotificationView> {
  5. var landmark: Landmark?
  6. var title: String?
  7. var message: String?
  8. let landmarkIndexKey = "landmarkIndex"
  9. override var body: NotificationView {
  10. NotificationView(
  11. title: title,
  12. message: message,
  13. landmark: landmark
  14. )
  15. }
  16. override func willActivate() {
  17. // This method is called when watch view controller is about to be visible to user
  18. super.willActivate()
  19. }
  20. override func didDeactivate() {
  21. // This method is called when watch view controller is no longer visible
  22. super.didDeactivate()
  23. }
  24. override func didReceive(_ notification: UNNotification) {
  25. // This method is called when a notification needs to be presented.
  26. // Implement it if you use a dynamic notification interface.
  27. // Populate your dynamic notification interface as quickly as possible.
  28. }
  29. }