NotificationController.swift 818 B

1234567891011121314151617181920212223242526
  1. import SwiftUI
  2. import UserNotifications
  3. import WatchKit
  4. class NotificationController: WKUserNotificationHostingController<NotificationView> {
  5. override var body: NotificationView {
  6. NotificationView()
  7. }
  8. override func willActivate() {
  9. // This method is called when watch view controller is about to be visible to user
  10. super.willActivate()
  11. }
  12. override func didDeactivate() {
  13. // This method is called when watch view controller is no longer visible
  14. super.didDeactivate()
  15. }
  16. override func didReceive(_: UNNotification) {
  17. // This method is called when a notification needs to be presented.
  18. // Implement it if you use a dynamic notification interface.
  19. // Populate your dynamic notification interface as quickly as possible.
  20. }
  21. }