Post

Replies

Boosts

Views

Activity

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
960
Jun ’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.2k
Apr ’23
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.3k
Apr ’23
Getting Large Titles on WatchOS with a Navigation Stack
On my Watch app pre-WatchOS 9 I had code as follows: ` TabView { NavigationView { TodayView(model: delegate.model) .navigationBarTitleDisplayMode(.large) } NavigationView { SettingsView(model: delegate.model) } } .tabViewStyle(.page) However, for WatchOS 9 I'm using the new NavigationStack like this: ` NavigationStack { TabView { TodayView(model: delegate.model) .navigationBarTitleDisplayMode(.large) The issue is, with WatchOS 9 the title always displays as .inline and never large. I've tried embedding a list or scroll view. I've also tried placing a navigationView within the NavigationStack and TabView, that just makes duplicate titles. So, using the NavigationStack with a TabView on WatchOS 9, how do you get large titles? Thanks
3
0
1.8k
Mar ’23
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.5k
Feb ’23
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.5k
Jan ’23
Full Keyboard Access causing SwiftUI TabView bug?
I’m having an issue with an app I’ve developed where it grinds to a halt and freezes when using the TabView with a certain iOS Setting enabled. To simplify things, I can easily reproduce this with a demo project. Launch Xcode 12.5, start a new iOS project with swift, swiftUI lifecycle and SwiftUI interface. Then replace the Text code in the content view body with ithe following simple code: TabView { Text("Hello, world! Tab 1")       .tabItem {            Label("Tab 1", systemImage: "list.dash")         }     Text("Tab 2")        .tabItem {            Label("Tab 2", systemImage: "list.dash")         }   } If you launch and run this on device or on the simulator, it all works fine. You can click between the tabs etc… However, if you navigate to the iPhone settings (and this is available in the simulator) and go Accessibility -> Keyboards -> Full Keyboard Access and toggle this ON, it causes a problem. When re-opening the app we just made, as soon as you select a tab at the bottom, the app CPU usage jumps to 100%+ and grinds to a halt. The only fix is to force quite the app, but the issue persists on re-launches until you disable Full Keyboard Access.  Is this a bug? Or am I missing something? It seems to have been around throughout iOS 14’s life time. Thank you
4
0
2.6k
Aug ’22
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]) } }
Replies
1
Boosts
0
Views
960
Activity
Jun ’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?
Replies
0
Boosts
0
Views
1.2k
Activity
Apr ’23
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
Replies
2
Boosts
0
Views
1.3k
Activity
Apr ’23
Getting Large Titles on WatchOS with a Navigation Stack
On my Watch app pre-WatchOS 9 I had code as follows: ` TabView { NavigationView { TodayView(model: delegate.model) .navigationBarTitleDisplayMode(.large) } NavigationView { SettingsView(model: delegate.model) } } .tabViewStyle(.page) However, for WatchOS 9 I'm using the new NavigationStack like this: ` NavigationStack { TabView { TodayView(model: delegate.model) .navigationBarTitleDisplayMode(.large) The issue is, with WatchOS 9 the title always displays as .inline and never large. I've tried embedding a list or scroll view. I've also tried placing a navigationView within the NavigationStack and TabView, that just makes duplicate titles. So, using the NavigationStack with a TabView on WatchOS 9, how do you get large titles? Thanks
Replies
3
Boosts
0
Views
1.8k
Activity
Mar ’23
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.
Replies
1
Boosts
0
Views
3.5k
Activity
Feb ’23
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
Replies
0
Boosts
0
Views
1.5k
Activity
Jan ’23
Full Keyboard Access causing SwiftUI TabView bug?
I’m having an issue with an app I’ve developed where it grinds to a halt and freezes when using the TabView with a certain iOS Setting enabled. To simplify things, I can easily reproduce this with a demo project. Launch Xcode 12.5, start a new iOS project with swift, swiftUI lifecycle and SwiftUI interface. Then replace the Text code in the content view body with ithe following simple code: TabView { Text("Hello, world! Tab 1")       .tabItem {            Label("Tab 1", systemImage: "list.dash")         }     Text("Tab 2")        .tabItem {            Label("Tab 2", systemImage: "list.dash")         }   } If you launch and run this on device or on the simulator, it all works fine. You can click between the tabs etc… However, if you navigate to the iPhone settings (and this is available in the simulator) and go Accessibility -> Keyboards -> Full Keyboard Access and toggle this ON, it causes a problem. When re-opening the app we just made, as soon as you select a tab at the bottom, the app CPU usage jumps to 100%+ and grinds to a halt. The only fix is to force quite the app, but the issue persists on re-launches until you disable Full Keyboard Access.  Is this a bug? Or am I missing something? It seems to have been around throughout iOS 14’s life time. Thank you
Replies
4
Boosts
0
Views
2.6k
Activity
Aug ’22