apple-watch

What's the equivalent of app delegate file for apple watch app?

余生长醉 提交于 2021-01-27 17:19:48
问题 I want to set the initial view controller for the watch app base on different type of notification received on the watch. But I don't know where's to set it. This is the answer for an iOS app Multiple entry points to a storyboard 回答1: watchOS 2 WKExtensionDelegate is the equivalent of the app delegate, where you can: respond to actionable notifications and manage Handoff transitions. You also use the delegate to respond to life-cycle events, such as the activation and deactivation of your app

How to determine the Apple Watch model?

ⅰ亾dé卋堺 提交于 2021-01-23 07:02:31
问题 The WKInterfaceDevice.current().model property does not give a model number: For Apple Watch, the value of this string is Apple Watch . How can the exact Apple Watch model be determined from iOS? 回答1: There is no public API to get that exact information. You can however use the following (I'll let you translate into Swift): - (NSString*) modelIdentifier { size_t size = 0; sysctlbyname("hw.machine", NULL, &size, NULL, 0); char* machine = malloc(size); sysctlbyname("hw.machine", machine, &size,

Apple Watch Exercise Minute ring being updated from workout start-end time not from the Duration

ぃ、小莉子 提交于 2021-01-07 01:26:45
问题 We have a Fitness app and we are writing fitness data to the Healthkit like Steps, Walking Running distance, and Active energy. and it is working as expected in the Health App We also writing Workout data for Apple watch activity ring, we can show our data is reflected on the Apple Watch activity ring for Active Energy but Exercise Minutes ring being updated from workout start-end time not from the Duration The problem here is the Exercise ring vs Actual exercise done. Our app is sending the

Apple Watch Exercise Minute ring being updated from workout start-end time not from the Duration

自闭症网瘾萝莉.ら 提交于 2021-01-07 01:22:49
问题 We have a Fitness app and we are writing fitness data to the Healthkit like Steps, Walking Running distance, and Active energy. and it is working as expected in the Health App We also writing Workout data for Apple watch activity ring, we can show our data is reflected on the Apple Watch activity ring for Active Energy but Exercise Minutes ring being updated from workout start-end time not from the Duration The problem here is the Exercise ring vs Actual exercise done. Our app is sending the

How to create an animated GIF

孤街浪徒 提交于 2020-08-27 15:42:52
问题 I’d like to create an animated GIF in SwiftUI. I tried: Adding a GIF to my assets and loading that through Image(“myGif”) Creating a UIImage through downloading a GIF image, and passing that to Image Using this script to create a UIImage and then repeating #2. None of the above worked, has anyone figured this out? 回答1: You can do it by creating UIViewRepresentable from UIView . UIViewRepresentable create View for you, which you can use it in SwiftUI class. Step1: Create UIView class for

How to create an animated GIF

本小妞迷上赌 提交于 2020-08-27 15:42:29
问题 I’d like to create an animated GIF in SwiftUI. I tried: Adding a GIF to my assets and loading that through Image(“myGif”) Creating a UIImage through downloading a GIF image, and passing that to Image Using this script to create a UIImage and then repeating #2. None of the above worked, has anyone figured this out? 回答1: You can do it by creating UIViewRepresentable from UIView . UIViewRepresentable create View for you, which you can use it in SwiftUI class. Step1: Create UIView class for

It is possible to use flutter to create something to Watch OS or Android Wear?

余生长醉 提交于 2020-06-25 02:50:13
问题 I'm studying some possibilities to use in my project, I would like to know if I can to communicate a Watch OS project with the IOS flutter project. 回答1: At the moment, neither watchOS, nor Android Wear is supported by Flutter. The lack of watchOS support is due to the lack of Bitcode support for iOS, as discussed in this GitHub issue. You can track the state of Adding Bitcode support for iOS - Flutter GitHub issue, but currently it seems to have a low priority for the Flutter development team

Implementing Page Based Navigation for SwiftUI Apple Watch App

拥有回忆 提交于 2020-06-23 05:58:07
问题 I'm building an Apple Watch app in SwiftUI and would like to implement page based navigation so when users swipe left on the home screen, they are taken to another view. I understand how to use NavigationLink to let users move from one screen to another, but not how to let users navigate from screen to screen by swiping left or right. Does anyone know how this can be done? 回答1: Here is a guide how to implement page-based navigation for watchOS using SwiftUI. The description is based on

Get Apple watch heartRateVariabilitySDNN realtime?

為{幸葍}努か 提交于 2020-06-16 02:40:05
问题 I am using below function to get heartRateVariabilitySDNN, but its get only once and not calculate realtime like hearbeat does? func HRVstart() { guard let quantityType = HKObjectType.quantityType(forIdentifier: .heartRateVariabilitySDNN) else { return } self.healthStore.execute(self.HRVStreamingQuery()) // Create query to receive continiuous heart rate samples. let datePredicate = HKQuery.predicateForSamples(withStart: Date(), end: nil, options: .strictStartDate) let devicePredicate =

How to update Watch Complication only when the watch is awake, to not use up the daily budget

我与影子孤独终老i 提交于 2020-05-10 18:49:33
问题 I have a server that keeps 2 booleans. These booleans change every 15 seconds. Whenever I wake my Apple Watch, I want the complication to show the current state. How can I do it withough exhausting the budget early on? The best way would be to fetch the newest state into the complication whenever I wake my watch. The only possible way I see would be to poll the server (either directly or via my phone) every 15 seconds. The problem is that I'd soon use up all the allotted time. It would be