Post not yet marked as solved
I’m trying to read the battery level of a connected Apple Watch on an iPhone app.
The built-in iOS Batteries widget shows the current Apple Watch battery level, so I know the data is being sent from Apple Watch to iPhone frequently, however I could not find a public API to read the level in my iOS app.
My best solution so far was to build an Apple Watch app that periodically sends the battery level of the Apple Watch to the iPhone using WatchConnectivity.
Then, I found this app.
It can show the battery level of my paired Apple Watch without ever installing an app on the Apple Watch.
To try to accomplish this same thing, I have tried a few different approaches.
First, I tried Core Bluetooth, but after a lot of exploring, troubleshooting, and asking at a Core Bluetooth lab, I’ve ruled that out since Apple Watch does not expose its battery information that way.
I experimented with the External Accessory framework, but that doesn’t seem like the right approach either, since it's for MFi accessories and I couldn't find a way to get Apple Watch info with it.
How is it possible to read the Apple Watch battery level in an iPhone app without sending it from a companion Apple Watch app?
Or is the app I linked to probably using private APIs?
I have multiple projects where I use the Firebase/Analytics pod installed with CocoaPods.
Everything builds fine on Xcode 12 beta 2, but when I try to build for a real device or simulator (instead of Any iOS Device) on Xcode beta 3, it fails. Is this a known issue that should be fixed in a future version of Xcode?
Building on beta 3 takes a lot longer, and finally fails with an error that says library not found for -lFirebaseCore.
I've tried updating, removing, and re-installing Firebase with CocoaPods, along with cleaning the build folder and deleting DerivedData, restarting the computer, and restarting Xcode, but nothing has helped.
Post not yet marked as solved
I'm migrating some views from UIKit to SwiftUI.
In my UIKit interfaces, I frequently use the readableContentGuide property with Auto Layout to handle horizontal spacing across different screen sizes - https://developer.apple.com/documentation/uikit/uiview/1622644-readablecontentguide.
Is there an equivalent in SwiftUI?
I've been using .padding, but short of providing conditional numerical values for different devices, I haven't found a way to automatically make horizontal spacing adapt to different screen sizes to create naturally-readable spacing. Is this possible?
My apps support almost all complication families.
I'm looking for ways to improve all my existing complications and design new ones considering the new features in watchOS 7, especially with custom designs using SwiftUI.
However, I'm confused about SwiftUI support across different complication families.
Is it possible to use SwiftUI to build a custom complication that takes up the entire space allocated to the complication family for all complication families?
Based on this session - https://developer.apple.com/videos/play/wwdc2020/10048/, I see that I can use CLKComplicationTemplateGraphicRectangularFullView, for example, along with edgesIgnoringSafeArea, to define a fully custom view that takes up the entire area allocated to a Graphic Rectangular family complication.
However, I am not seeing analogous classes available for other families. For example, most users of my app use the Graphic Corner complication family. There are three new classes I see for that family: CLKComplicationTemplateGraphicCornerGaugeView
CLKComplicationTemplateGraphicCornerCircularView
CLKComplicationTemplateGraphicCornerTextView
None of these new classes seems to allow replacing the entire area allocated to a Graphic Corner template to a SwiftUI View like CLKComplicationTemplateGraphicRectangularFullView does. Does that mean it's not possible to use SwiftUI to build custom complications for many families?
CLKComplicationTemplateGraphicCornerCircularView seems the closest, but only takes up a small portion of the Graphic Corner space, so it's not a good fit for my apps, which use gauges for this family.
CLKComplicationTemplateGraphicCornerGaugeView has nowhere to provide a View, but does accept a Label, however this is very limited and based on my testing is extremely buggy and doesn't actually work. It doesn't seem to allow for any more customization than CLKComplicationTemplateGraphicCornerGaugeText did, except maybe to add one SF Symbol, if it were working correctly.
Are SwiftUI complications limited to only a subset of complication families? And if so, is there any documentation that shows which ones are supported?
Also, since I said CLKComplicationTemplateGraphicCornerGaugeView is not working, here's my example code with an attempt to use it with a Label:
struct Complication_Previews: PreviewProvider {
static let gaugeProvider = CLKSimpleGaugeProvider(
style: .fill,
gaugeColor: .white,
fillFraction: 0.69)
static var previews: some View {
CLKComplicationTemplateGraphicCornerGaugeView(
gaugeProvider: gaugeProvider,
label: Label("Test",
systemImage: "iphone"))
.previewContext()
}
}
I can't seem to attach an image here, but if you run that code the preview will show the iPhone SF Symbol then "..." because the Test text gets truncated.