Posts

Post not yet marked as solved
5 Replies
Thanks for the feedback. After checking the loadVocabulary() method, the Dictionary(uniqueKeysWithValues: zip(words, values) is never initialized and the thread runs forever. The 2 arguments -> word: [String.Subsequence] and value: Range<Int> seems correct after printing them. Thus, the issue might come from the Dictionary(uniqueKeysWithValues: ) initialization. I'll give a try to see how long it takes to build the dictionary. Alexis
Post not yet marked as solved
1 Replies
For the count down, I used this code and it solves the problem perfectly. &#9;&#9;&#9;&#9;.onReceive(NotificationCenter.default.publisher(for: WKExtension.applicationWillResignActiveNotification)) { _ in &#9;&#9;&#9;&#9;&#9;&#9;print("Moving to the background") &#9;&#9;&#9;&#9;&#9;&#9;notificationDate = Date() &#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;.onReceive(NotificationCenter.default.publisher(for: WKExtension.applicationDidBecomeActiveNotification)) { _ in &#9;&#9;&#9;&#9;&#9;&#9;print("Moving to the foreground") &#9;&#9;&#9;&#9;&#9;&#9;let deltaTime: Int = Int(Date().timeIntervalSince(notificationDate)) &#9;&#9;&#9;&#9;&#9;&#9;timeRemaining -= deltaTime &#9;&#9;&#9;&#9;&#9;&#9;percent += Double(deltaTime) / 1.2 &#9;&#9;&#9;&#9;} But when the count down reaches 0, I need to provide a sort of Haptic Feedback to the user in order to tell him/her that the resting time is over. I have an issue when the watch is in sleep mode (wrist down). I am thinking on using User Notification for this purpose. I used a simple test notification with a 5 second timer. It works perfectly when I quit the app before the 5 sec countdown, but not when I stay in the app with a wrist down (to put the watch in sleep mode) How should I use local notification to work even if I stay in the app in sleep mode? I am not too familiar with the UserNotifications framework :( Thanks for your feedback