Post

Replies

Boosts

Views

Activity

Reply to Apple Watch willActivate method not called
Yes @Claude31 thanks for your response. Here is NotificationController.swift: import WatchKit import SwiftUI import UserNotifications class NotificationController: WKUserNotificationHostingController<NotificationView> {     override var body: NotificationView {         return NotificationView()     }     override func willActivate() {         // This method is called when watch view controller is about to be visible to user         super.willActivate()         print("TEST")     }     override func didDeactivate() {         // This method is called when watch view controller is no longer visible         super.didDeactivate()         print("TEST")     }     override func didReceive(_ notification: UNNotification) {         // This method is called when a notification needs to be presented.         // Implement it if you use a dynamic notification interface.         // Populate your dynamic notification interface as quickly as possible.     } } And here it is implemented: import SwiftUI @main struct QRableApp: App {     @SceneBuilder var body: some Scene {         WindowGroup {             NavigationView {                 ContentView()             }         }         WKNotificationScene(controller: NotificationController.self, category: "myCategory")     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’21
Reply to Crash on iOS 14 when using @available(iOS 15.0, *) @FocusState variable in SwiftUI
I am also having this issue. It is crashing on iPhone 8 (iOS 14.7.1)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22
Reply to Sharing images with UIActivityViewController doesn't work
I've solved it. The problem was that the image was ciimage. The problem is described here: https://www.hackingwithswift.com/forums/swift/silent-failure-of-uiimagewritetosavedphotosalbum/872
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Incorrect app icon on the device App's Preview
I had a same issue. Try restarting your device and reinstalling your app. It could be cached.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Oct ’21
Reply to Apple Watch willActivate method not called
Yes @Claude31 thanks for your response. Here is NotificationController.swift: import WatchKit import SwiftUI import UserNotifications class NotificationController: WKUserNotificationHostingController<NotificationView> {     override var body: NotificationView {         return NotificationView()     }     override func willActivate() {         // This method is called when watch view controller is about to be visible to user         super.willActivate()         print("TEST")     }     override func didDeactivate() {         // This method is called when watch view controller is no longer visible         super.didDeactivate()         print("TEST")     }     override func didReceive(_ notification: UNNotification) {         // This method is called when a notification needs to be presented.         // Implement it if you use a dynamic notification interface.         // Populate your dynamic notification interface as quickly as possible.     } } And here it is implemented: import SwiftUI @main struct QRableApp: App {     @SceneBuilder var body: some Scene {         WindowGroup {             NavigationView {                 ContentView()             }         }         WKNotificationScene(controller: NotificationController.self, category: "myCategory")     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Is it possible to adjust brightness in SwiftUI?
Yes it says Cannot find 'UIScreen' in scope even If I import UIKit
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’21
Reply to Xcode cannot download the APP to my phone,since device is busy
I would try to reboot your iPhone or Apple watch. Not sure If it will help but you can try it. Pavel
Replies
Boosts
Views
Activity
Sep ’21