Post

Replies

Boosts

Views

Activity

Does anyone implement getAlwaysOnTemplate in their App for Apple Watch Complications on the Always-On Display
I supported the Always-On display in my app complications from day one but since am continuing to find animation glitches and bugs that have never been fixed and exist currently on WatchOS 8 & 9 (I've tried Series 6 & 8 devices). I'm thinking about scrapping it and just returning the handler(nil). Does anyone have an example of where they use it and it really adds value to their app complications? And do they have any suggestions to try and work around the glitches? Thanks
0
0
1.4k
Jan ’23
Watch app Optimize performance & Launch time
I'm trying to ensure my watch app launches as quickly as possible. I'm using the @WKApplicationDelegateAdaptor because of needing to implement the BackgroundRefresh handlers. What I'm finding is that the time between the app calling the main init() and then the ExtensionDelegate calling applicationDidFinishLaunching is often > 2 seconds. I've tried using Instruments to profile the App launch but have never had any luck with the tool on a watch app. So I then created a blank project just with the elements needed to implement the same WKApplicationDelegateAdaptor and oslog calls, performance was the same... This is tested on WatchOS 9.5 & 9.5. This is on a Series 6 and Series 8 Apple Watch (FYI S6 == S7 == S8 for Apple Watch CPU performance) Interestingly, on the simulator, the time gap was less, more like 1 second between main init() and applicationDidFinishLaunching.... not sure why this would be this way. Anyway, for real world device usage, is this the best performance I can expect? Is there anything that can be done to improve this?
0
0
1.1k
Apr ’23
iPad NavigationSplitView UI Glitch with TabView Page style
I'm having a problem in my app where when the use dismisses the side bar in a NavigationSplitView, the TabView on the detail view animates with a glitch to an offset page position. I've simplified the issue into a Single View which can be previewed in Xcode. This issue occurs on real hardware and in the simulator. This issue only occurs in landscape on iPad when dismissing the sidebar. Here is the code: struct ContentView: View { @State var pageIndex = 9 var body: some View { NavigationSplitView { Text("AppSidebarList") } detail: { TabView(selection:$pageIndex) { ForEach(0..<10, id:\.self) { i in ScrollView(.vertical, showsIndicators: false) { Text("Page \(i)").padding(.top,50) Rectangle().fill(Color.red) .frame(height:25).frame(maxWidth:.infinity) .padding() } } }.tabViewStyle(.page(indexDisplayMode: .never)) }.accentColor(Color.indigo) } } Here is the preview before selecting anything: This is then the expected behaviour after selecting the button top left to hide the sidebar: But instead the transition animation glitches and I get this: Note, the page is offset as indicated by the red bar. I've tried playing around with frame of maxWidth:.infinity. This issue does not happen if the iPad is in portrait, this seems to be because the sidebar in this mode overlays the detail view, where as in portrait they share the space and the detail view resizes to fill the space. Note the page index, it's the app behaviour that the TabView shows a selection of pages with the last one being the default and the user swiping backwards through. This issue does not occur if the default pageIndex is 0 Either this is a bug or there's a work around or I'm not using something correctly. It would be good to establish which. Many thanks
0
0
942
Aug ’23
Snippet Views don't render consistently, width not always respected
I've created a Snippet for my iOS app which I want to be able to run from the LockScreen via a Shortcuts widget. All works fine except when I run the shortcut and the App Snippet appears, it doesn't always render the SwiftUI view in the same way. Sometimes the width boundaries are respected and sometimes not. I've tested this on iOS 26.1 and iOS 26.2 beta 3 I think this is a bug but it would be great if anyone could see what I might be doing wrong if it's not. Incase it is a bug I've filed a feedback (FB21076429) and I've created a stripped down sample project showing the issue and added screenshots showing the issue. Basic code to reproduce issue: // Intent.swift // SnippetBug import AppIntents import Foundation import SwiftUI struct SnippetEntryIntent: AppIntent { static let title: LocalizedStringResource = "Open Snippet" static let description = IntentDescription("Shows a snippet.") // Don’t open the app – stay in the snippet surface. static let openAppWhenRun: Bool = false func perform() async throws -> some ShowsSnippetIntent { .result(snippetIntent: TestSnippetIntent()) } } struct TestSnippetIntent: SnippetIntent { static let title: LocalizedStringResource = "Snippet Intent" static let description = IntentDescription("Action from snippet.") @MainActor func perform() async throws -> some IntentResult & ShowsSnippetView { .result(view: SnippetView(model: SnippetModel.shared)) } } @MainActor final class SnippetModel { static let shared = SnippetModel() private init() { } } struct SnippetView: View { let model: SnippetModel var body: some View { HStack { Text("Test Snippet with information") Spacer() Image(systemName: "heart") }.font(.headline) } } struct Shortcuts: AppShortcutsProvider { static var appShortcuts: [AppShortcut] { AppShortcut( intent: SnippetEntryIntent(), phrases: [ "Snippet for \(.applicationName)", "Test Snippet \(.applicationName)" ], shortTitle: "Snippet", systemImageName: "barcode" ) } } You also need these lines in your main App entry point: import AppIntents @main struct SnippetBugApp: App { init() { let model = SnippetModel.shared AppDependencyManager.shared.add(dependency: model) } var body: some Scene { WindowGroup { ContentView() } } } This is correct This is incorrect
0
0
64
3w
Hide & Disable TabBar when in NavigationDestination Subview - Apple Watch
I'm trying to create a UI layout and navigation functionality similar to the Apple Fitness app on Apple Watch. This is all WatchOS 9 so no need for older API support, phew! I want to have NavigationTitle set for each view in a TabBar. I want each selected NavigationDestination to hide the TabBar controls and disable swiping when opened. I want the NavigationTitle and update to remain whilst navigating between Tabs and Childs. I've created this sample code based off the Building a productivity app for Apple Watch sample code from Apple and other examples on navigation with the new NavigationStack in WatchOS 9, iOS 16 etc... import SwiftUI @main struct Test_Watch_App_Watch_AppApp: App {     @SceneBuilder var body: some Scene {         WindowGroup {             TabView {                 NavigationStack {                     ScrollView {                         VStack {                             NavigationLink("Mint", value: Color.mint)                             NavigationLink("Pink", value: Color.pink)                             NavigationLink("Teal", value: Color.teal)                         }                     }                     .navigationDestination(for: Color.self) { color in                         Text("Hello").background(color)                     }                     .navigationTitle("Colors")                 }                 NavigationStack {                     ScrollView {                         VStack {                             NavigationLink("headline", value: Font.headline)                             NavigationLink("title", value: Font.title)                             NavigationLink("caption", value: Font.caption)                         }                     }                     .navigationDestination(for: Font.self) { font in                         Text("Hello").font(font)                     }                     .navigationTitle("Fonts")                 }             }.tabViewStyle(.page)         }     } } The problem here is, when selecting any of the Navigation Links, the child view still displays the Tab Bar page indicators and allows you to swipe between the tabs, I don't want this. The functionality as I'd like exists int eh Apple Fitness app on the Watch. The app launches in the Activity Tab. You can swipe across to Sharing, select a person, and in that view it's not then possible to swipe straight back to Activity. I've tried Embedding the whole TabView in a NavigationStack and removing the NavigationStacks per tab. This works as far as fixing the child views hiding the TabBar page indicator controls and swiping. However, it then breaks NavigationTitles on launch and when moving in and out of Childs, so I don't think it should be this way. Any help very appreciated.
1
0
3.3k
Feb ’23
WidgetKit Text Relative Dates don't update in .widgetLabel area
Relative Date labels on WatchOS complications do not update when in the .WidgetLabel section modifier. Am I missing anything? For example if I want a .accessoryCircular complication in the top centre middle of the Infograph Watch Face, I can have maybe an Icon for the app in the circular slot and then use the .WidgetLabel modifier to display text. However, the Text(Date(), style: .relative) will not update in the WidgetLabel area, but it will update in main area. This is a bug I suspect. This same problem also exists with the .accessory corner complications and the WidgetLabel. The best example of where this works fine currently in the WatchOS system is the Heart Rate complication. Here the WidgetLabel text shows the relative date. It also has formatting options for the date (like only showing minutes), none of this is available to third party developers. Have tested this on the latest public releases of iOS, WatchOS & Xcode as well as the new iOS 17, WatchOS 10 and Xcode 15 Beta releases. Example Code: import SwiftUI import WidgetKit struct WatchWidget: Widget { let kind: String = "WatchWidget" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: TimelineProvider()) { entry in Text(Date(), style: .relative) .widgetLabel { Text(Date(), style: .relative) } } .configurationDisplayName("WatchWidget") .description("WatchWidget") .supportedFamilies([.accessoryCircular, .accessoryCorner]) } }
1
0
896
Jun ’23
Apple Watch Modular Ultra face clips text and affects font positioning
I'm seeing problems with the new Apple Watch Modular Ultra Watch face... This is all using the latest WatchOS 10.1 and with WidgetKit complications. (Have also tested with the new WatchOS 10.2 beta in the simulator) The Graphic Circular (accessoryCircular) complications space the numbers differently sometimes causing maximum and minimum numbers to look like one long number (see small circular complications in screenshot) The exact same complication in the accessoryRectangular on the Modular Ultra face clips text when it doesn't on any other watch face I've filed feedback FB13344580 Hopefully the screenshots show the issue well.
1
0
1.2k
Nov ’23
AttributeGraph: cycle detected Warning with WatchOS app
I've been seeing warning like the following with my Apple Watch app: === AttributeGraph: cycle detected through attribute 140952 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === === AttributeGraph: cycle detected through attribute 131640 === I've done some debugging with Instruments and Xcode, I've determined that its caused by adding a .toolbar { ToolbarItemGroup(placement: .topBarTrailing) { Label("Stop", systemImage: "xmark") } } to an item within my NavigationSplitView List Destination view. To aid reproduction of this issue even more, I've verified the same warning occurs with the Apple sample code from the WWDC23 Backyard Birds app. https://developer.apple.com/documentation/swiftui/backyard-birds-sample?changes=_9 If you take the Apple sample code, open it in Xcode 15.4 and run it in the Apple Watch WatchOS 10.5 simulator, then select the Bird Springs item, all is well. If you then add the above toolbar code to the BackyardSummaryTab file at the bottom of the VStack, you'll see the same AttributeGraph issues I'm seeing in my app. Is this a bug? I can't understand why adding a static ToolBarItem in WatchOS is causing this. I've seen this issue in the simulator and also on device.
1
0
1.7k
Jun ’24
Swift Chart Zoom/Magnification/Pinch Gesture
Is there any approach or sample code available to use these APIs: .chartScrollableAxes(.horizontal) .chartScrollPosition(x: ...) .chartScrollPosition(initialX: ...) .chartScrollTargetBehavior(...) .chartXVisibleDomain(length: ...) Plus a gesture recognised or Pinch or Magnification to create a Swift Chart with an X axis that can be zoomed in or out with a pinch gesture? And when zoomed in at any level above 0, the chart can then be scrolled left to right along the X axis. I've had success using .chartScrollableAxes with .chartXSelection in parallel, so would also like to keep the ability to select X values too.
1
1
1.1k
Jul ’24
App not compatible with iPad model, but it is?
I’m having an issue with my published iPad app on the App Store where a selection of users (but not all) are finding they are unable to download my app on their iPad. The app recently was updated to support only devices Running iOS/iPadOS 17 and also added iPad support as HealthKit is available there now. The App Store listing correctly shows it as compatible but for some reasons user still see incompatibility messages. This makes no sense as the app has been full built and tested on iPad and a lot of users are using it fine. All the iPads in question are running ipadOS 17 too. I can only assume this is a bug but I thought I’d post here in case maybe I had an Xcode build setting wrong or something. Thank You
1
0
854
Aug ’24
Effective use of .disfavouredLocations API
I have a Health & Fitness widget that runs on iPhone and Apple Watch. As Health data access requires the device to be unlocked, the iPhone widget is already slightly limited in capability because of updates. With widgets further expanding to places like CarPlay, I know I can use the .disfavouredLocations{} API to try and prevent it being offered there. This is crucial as the widget functionality would be basically non-existent as your device is locked during CarPlay use. My problem is, on the Mac despite using the .disfavouredLocations{.iPhoneWidgetsOnMac} etc...., the widget can still be added in the "other unsupported section". And yet, in that section the Apple Fitness app widget is no where to be seen. Is there an API I am missing to completely remove a widget from the Mac widget gallery and hopefully CarPlay, Standby etc.... (all places where the device running the widget is usually locked -> No Health data)? Or does the Apple Fitness app have a private API to block it from these places where its function is not wanted and this isn't available to other apps?
1
0
115
Jun ’25
WidgetKit WidgetConfigurationIntent Parameter Icons
In WatchOS 26 you can now configure Apple Watch Widgets that use AppIntents instead of having a preconfigured option via AppIntentRecommendation. This is demonstrated in the Weather Details Widget. In that, the Intent has been set up such that the options have icons for each parameter. How can I update my Intent code to offer this? struct DataPointsWidgetIntent: AppIntent, WidgetConfigurationIntent { static var title: LocalizedStringResource = "Data Points Widget Configuration" static var description = IntentDescription("Configure the individual data point display for Widgets.") static var isDiscoverable: Bool { return false} init() {} func perform() async throws -> some IntentResult { print("DataPointsWidgetIntent perform") return .result() } @Parameter(title: "Show Individual Data Points", default: true) var showDataPoints: Bool? @Parameter(title: "Trend Timescale", default: .week) var timescale: TimescaleTypeAppEnum? static var parameterSummary: some ParameterSummary { Summary("Test Info") { \.$showDataPoints \.$timescale } } } enum TimescaleTypeAppEnum: String, AppEnum { case week case fortnight static var typeDisplayRepresentation = TypeDisplayRepresentation(name: "Trend Timescale") static var caseDisplayRepresentations: [Self: DisplayRepresentation] = [ .week: "Past Week", .fortnight: "Past Fortnight" ] }
1
1
121
Jun ’25
Xcode 26 Beta 5 HealthKit DLYD Symbol Crash
I'm having a problem with Xcode 26 where a symbol bug is causing my app to crash at launch if they are running iOS 17.X This has to do with a HealthKit API that was introduced in iOS 18.1 HKQuantityType(.appleSleepingBreathingDisturbances), I use availability clauses to ensure I only support it in that version. This all worked fine with Xcode 16.4 but breaks in Xcode 26. This means ALL my users running iOS 17 will get at launch crashes if this isn't resolved in the Xcode GM seed. I'll post the code here in case I'm doing anything wrong. This, the HealthKit capability, the "HealthKit Privacy - Health Share Usage Description" and "Privacy - Health Update Usage Description", and device/simulator on iOS 17.X are all you need to reproduce the issue. I've made a feedback too as I'm 95% sure it's a bug: FB19727966 import SwiftUI import HealthKit struct ContentView: View { var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") } .padding() .task { print(await requestPermission()) } } } #Preview { ContentView() } func requestPermission() async -> Bool { if #available(iOS 18.0, *) { let healthTypes = [HKQuantityType(.appleSleepingBreathingDisturbances)] var readTypes = healthTypes.map({$0}) let write: Set<HKSampleType> = [] let res: ()? = try? await HKHealthStore().requestAuthorization(toShare: write, read: Set(readTypes)) guard res != nil else { print("requestPermission returned nil") return false } return true } else { return false} }
1
0
157
Aug ’25
AppIntentConfiguration WatchOS & iOS inconsistent
I'm having problems with my released app with iOS & WatchOS 26 support. I've added AppIntentConfiguration support in the WatchOS app such that users can configure the complication. My complications also support multiple families and so I have slightly different configuration options available if its in the .accessoryRectangular slot or the .accessoryCircular one. This works fine on Apple Watch when editing the Watch face. Here you can then select the configuration options fine and they are correct for the different variants. However on iOS when configuring in the Apple Watch app on iPhone, the different complication size is ignored and the same configuration options are offered meaning they are wrong for one of them. I created a sample project, here is the app intent code: struct TestWidgetConfigurationIntent: AppIntent, WidgetConfigurationIntent { static var title: LocalizedStringResource = "New Widgets with Configuration" static var description = IntentDescription("Lots of stuff.") static var isDiscoverable: Bool { return false} init() {} func perform() async throws -> some IntentResult { return .result() } @Parameter(title: "Enable More Detail", default: true) var moreDetail: Bool @Parameter(title: "Enable Other Parameter", default: true) var otherParameter: Bool static var parameterSummary: some ParameterSummary { When(widgetFamily: .equalTo, .accessoryRectangular) { Summary("Test Info") { \.$moreDetail \.$otherParameter } } otherwise : { Summary("Test Info") { \.$moreDetail } } } } In WatchOS you get the correct configuration options: In iOS you do not, you get the same configuration option regardless of which family size you select: This could be a bug so I've filed feedback FB20328319. Otherwise if anyone has insights, it would be very appreciated. This is all tested on the current iOS 26.0 and WatchOS 26.0 versions. Thanks!
1
1
153
Oct ’25
How can I apply the modify my Swift Chart based on the ComplicationRenderingMode
For Apple Watch complications displayed on tinted faced, developers can use: @Environment(\.complicationRenderingMode) var renderingMode to see if the watch face is tinted. You can then use the .complicationForeground() modifier to set elements of the complication to match that tint color. (I appreciate that .complicationForeground() is now deprecated in favour of .widgetAccentable() but I believe the behaviour is the same). However, this can only be applied to a view I believe. I'd like to display a Swift Chart where only certain elements of the chart have the .complicationForeground() rather than the whole chart. For example, in one case I'd like the LineMark to pop with the tinted color of the complication whilst the rest of the complication get the gray default tint. Is there a way to do with with the current APIs? Thanks
2
0
1.2k
Apr ’23