apple-watch

Use NavigationLink programmatically in SwiftUI

本小妞迷上赌 提交于 2020-03-13 06:47:59
问题 I'm looking for a way to display a view in my WatchOS application "one level in" from the NavigationView on app startup if certain conditions are met. I want the same effect as if I would have pressed a NavigationLink myself, i.e being able to go back to the NavigationView again, which is not possible if I choose to display the desired view right away. "navigationBarItems" is also not available for WatchOS which makes it impossible to navigate backwards without actually clicking the

Scheduling complication updates

本秂侑毒 提交于 2020-02-28 09:46:42
问题 I have a custom complication on Apple Watch that I am trying to get to update once an hour. Each hour it should ping an API endpoint and if the data has changed from the last check, the complication should be updated. Here is what I currently have that only seems to work once in a blue moon. When it DOES work, it does indeed ping my server and update the complication. It appears WatchOS just isn't calling my scheduled tasked once per hour. Is there a better standard practice that I'm missing?

Scheduling complication updates

北慕城南 提交于 2020-02-28 09:46:17
问题 I have a custom complication on Apple Watch that I am trying to get to update once an hour. Each hour it should ping an API endpoint and if the data has changed from the last check, the complication should be updated. Here is what I currently have that only seems to work once in a blue moon. When it DOES work, it does indeed ping my server and update the complication. It appears WatchOS just isn't calling my scheduled tasked once per hour. Is there a better standard practice that I'm missing?

WatchKit app losing data after going background - Swift

非 Y 不嫁゛ 提交于 2020-02-24 11:32:49
问题 I'm passing a dictionary from my iPhone to the watch using the (watchOS 2) applicationContext method. Inside the iPhone app: func giveMeInfo(){ var lastStringUsed = porkee288.storyPoints.last! do { let resultDict = ["dict": myDict] try WCSession.defaultSession().updateApplicationContext(resultDict) } catch { print("Something wrong happened") } } Inside the watch app: func session(session: WCSession, didReceiveApplicationContext applicationContext: [String : AnyObject]) { dispatch_async

How does the inbuilt Workout app on Apple Watch navigate from main table row to a set of page-based controllers?

早过忘川 提交于 2020-02-02 11:12:30
问题 I was trying to mimic the Workout app for practise. And I got stuck at figuring out how to do this navigation from these table rows in the main screen to the 3/4 Workout starting screens which are page-based and seem to be hierarchical, with a back button on top left. They are most certainly not Modal as they do not appear from the bottom. - - -> However I did not find any way to connect a row to a set of page-based interface controllers with push segue. This is what I tried: 1-

How do you fill entire Button area with background View in WatchOS?

泪湿孤枕 提交于 2020-01-24 20:49:08
问题 I am trying to have my background view span the entire area of a Button on an Apple Watch form factor. struct SurveyView: View { var body: some View { Button(action: { print("Test tapped.") }) { HStack { Text("Test") .fontWeight(.semibold) } .frame(minWidth: 0, maxWidth: .infinity) .padding() .foregroundColor(.white) .background(LinearGradient(gradient: Gradient(colors: [.green, .blue]), startPoint: .leading, endPoint: .trailing)) } } } How can I make the background span the entire Button?

Apple Watch Table - first 4 rows not appearing

我的梦境 提交于 2020-01-22 20:54:28
问题 I'm having problems adding rows to WKInterfaceTable on Apple Watch. The weird thing is that no matter what I do, the first 4 rows appear as empty. I tried adding rows manually and in a loop - doesn't matter. I believe my code is good because 5th and further rows appear just fine. Here's what happens: Scroll further: My code: import Foundation import WatchKit class TableInterfaceController: WKInterfaceController{ @IBOutlet weak var agentTable: WKInterfaceTable! let agents = ["The Dude","Walter

Get Data to Complication: ExtensionDelegate not Called

五迷三道 提交于 2020-01-22 20:18:07
问题 (It looks like this issue has been encountered by others in previous weeks, but there haven't been any solutions that I've found.) I'm trying to do a really basic thing: Get data from either my iOS app or my Watch app to my Complication Controller. I am turning out to be way less capable of getting this done than I thought. watchOS 2 Transition Guide indicates that I should "[fetch] the needed data from the extension delegate" using the following code: ExtensionDelegate* myDelegate = [

Access workout data even when apple watch screen turn off

这一生的挚爱 提交于 2020-01-20 02:53:05
问题 I success to get heart rate data in live without workout session on apple watch os 2. But when apple watch screen turn off, my completion block is not anymore called. I would like to continue to manage these data in live and to make my phone ring when heart rate is too low. Maybe i can let the app on the iphone perma open and maybe it can access to the healthkit data during this workout ? Do you think this can work ? or do you have another idea ? Regards 回答1: Hey i found a solution : i keep

Apple watch scene Background scrolls

我的未来我决定 提交于 2020-01-16 02:26:09
问题 I am developing an app for Apple's new iWatch. As its iWatch appilcation we must use storyboard with limited controls. Our graphics team is asking to set Background in all the scenes in the storyboard . We have successfully set Background property of scene but problem is when screen scrolls the background image also scrolls. So my problem is simple i just want groups on my scene to scroll not the Background i set to scene. Thanks in advance. 回答1: The short answer is no. This answer was