Post

Replies

Boosts

Views

Activity

Reply to Swift Charts performance when displaying many data points
I thought I'd pick this up and test it with the new iOS 18 PointPlots. I setup this code to switch between a ForEach on the PointMarks and a Point Plot. import SwiftUI import Charts @available(iOS 18.0, *) struct ManyPointsChart: View { // Reduced data point count to 10,000 as 100,000 still V. poor performance let dataPoints: [DataPoint] = (0..<10_000).map { DataPoint(xValue: $0, yValue: Double($0)) } @State var selectedIndex:Int? var body: some View { Chart { if let selectedIndex { RuleMark(x: .value("selected", selectedIndex)) } // Original Method // ForEach(dataPoints) { dataPoint in // PointMark(x: .value("Index", dataPoint.xValue), // y: .value("Y Value", dataPoint.yValue)) // } //New in iOS 18 PointPlot( dataPoints, x: .value("Longitude", \.xValue), y: .value("Capacity density", \.yValue) ) } .chartXSelection(value: $selectedIndex) } } @available(iOS 18.0, *) #Preview { ManyPointsChart() } struct DataPoint: Identifiable { var id: Double { Double(xValue) } let xValue: Int let yValue: Double } Despite reducing the data points count to 10,000 I still found Selection performance very slow in Preview. (M3 Max MBP) Performance was improved with the PointPlot vs the PointMarks, but not quite as much as I hoped. I think I'm using the APIs correctly but would welcome any feedback if not!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to How to support foregroundColor (deprecated) and foregroundStyle in watchOS 9/10?
I think you've summarised the problem very well. The Nil Coalescing blog "Using foregroundColor(), foregroundStyle() or tint() to set text color in SwiftUI" explains well the differences between .foregroundColor and .foregroundStyle and makes it clear that the reason .foregroundColor otherwise still works it because it still return Text rather than View. It would be great to get some official guidance from Apple on this given we're now approaching WatchOS 11, everything is WidgetKit etc....
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to How long does Apple Watch keep HealthKit data?
UPDATE From testing on an Apple Watch Series 6 running WatchOS 11.0 Beta 1, it appears there are no significant changes to the availability of past Health data on Apple Watch. Unfortunately I've just found that in general you can only rely on the past 7 days of Health data being there. It could be that this changes in a later beta or it could be that the Series 6 Apple Watch (oldest supported by WatchOS 11) behaves differently to maybe 64GB Apple Watches such as the Ultra 2. Regardless, it's not something I would plan for or rely on in WatchOS 11. If you're still desperate for more Health data either consider a background task and caching it over time, or file a feedback and question how the new Vitals app and also Workout training loads achieve more Health access.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’24
Reply to Crashes "[RenderBox] RB::Animation::size(RB::Animation::TermOrArg const*, unsigned long) EXC_BAD_ACCESS" on iOS 17
Further to my previous post in May providing the crash log and following a WWDC24 discussion with a DTS Engineer, I've since determined the crash I see on iOS 17.4 & 17.5 is unrelated to others in this post. We've determined my issue is likely an iOS/SwiftUI issue/bug rather than something I am able to fix. I've submitted a feedback FB13904299
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to How to use a WidgetBundle in @available(iOS ver, *)
Would something like this format help? import WidgetKit import SwiftUI @main struct AppWidgets { // Combine widgets in this way to prevent crashes. static func main() { if #available(iOSApplicationExtension 18.0, *) { WidgetsBundle18.main() } else { WidgetsBundle17.main() } } } @available(iOSApplicationExtension 18.0, *) struct WidgetsBundle18: WidgetBundle { var body: some Widget { NewWidget() } } struct WidgetsBundle17: WidgetBundle { var body: some Widget { OldWidget() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to Any changes in HRV sample frequency in watchOS 11?
Just expanding on my previous comment... Apple Watch really lags behind in this area. Although it does record HRV data it simply doesn’t record enough to provide effective insights and trends to users. My app users are CONSTANTLY asking me how to record more HRV data, how to trigger a recording from my app and how to track it more effectively. This is all very difficult in WatchOS currently. I've filed a feedback FB13880126 and mentioned it at two WWDC labs. 🙏🙏 This might get picked up this summer.
Jun ’24
Reply to Updating Widgets from StaticConfiguration to IntentConfiguration Requires Re-Installation
With all the new Intent based push and APIs... this seems like a glaring omission for developers who originally made more straightforward StaticConfiguration widgets and now want to upgrade them to more advanced and configurable IntentConfiguration ones. It seems that if I keep the same “kind” String identifier for the widget, they do migrate but only after a restart of the iPhone…. Until that point they just freeze and hang. This isn't really something I can ask my users to do.... I've filed a feedback: FB13880020 🙏🙏 This might get fixed for iOS 18.
Topic: App & System Services SubTopic: General Tags:
Jun ’24
Reply to Background Health Store Access for Lock Screen Widgets
@Thuri88 This looks like a fantastic suggestion, Thank You! I'll go ahead and implement this and do some testing. You mention Apple's activity rings Lock Screen widget implementing this.... I'm fairly sure I've observed it updating throughout the day without the iPhone being unlocked at all. There's also then the problem of StandBy mode and Widget on Mac which also can't update whilst your iPhone is locked.... and lots of my users would love to see their Health data in widgets on their Mac. I've filed a feedback again on this: FB13879739 🙏🙏 A solution may be offered one day.
Jun ’24
Reply to How long does Apple Watch keep HealthKit data?
I believe this may have changed with WatchOS 11. Presumable this was done to allow for the new Vitals app and also Workout training loads to look at the longer 28 day trends and identify differences. I'll do some testing and try to come back with some actual available timescales for this against Health types: Heart Rate HRV Blood Oxygen Saturation Body Temperature Steps Activity Workouts Might take me a few weeks incase I have to have had WatchOS 11 installed for the elapsed time period to see the data!
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’24
Reply to Swift Charts performance when displaying many data points
I thought I'd pick this up and test it with the new iOS 18 PointPlots. I setup this code to switch between a ForEach on the PointMarks and a Point Plot. import SwiftUI import Charts @available(iOS 18.0, *) struct ManyPointsChart: View { // Reduced data point count to 10,000 as 100,000 still V. poor performance let dataPoints: [DataPoint] = (0..<10_000).map { DataPoint(xValue: $0, yValue: Double($0)) } @State var selectedIndex:Int? var body: some View { Chart { if let selectedIndex { RuleMark(x: .value("selected", selectedIndex)) } // Original Method // ForEach(dataPoints) { dataPoint in // PointMark(x: .value("Index", dataPoint.xValue), // y: .value("Y Value", dataPoint.yValue)) // } //New in iOS 18 PointPlot( dataPoints, x: .value("Longitude", \.xValue), y: .value("Capacity density", \.yValue) ) } .chartXSelection(value: $selectedIndex) } } @available(iOS 18.0, *) #Preview { ManyPointsChart() } struct DataPoint: Identifiable { var id: Double { Double(xValue) } let xValue: Int let yValue: Double } Despite reducing the data points count to 10,000 I still found Selection performance very slow in Preview. (M3 Max MBP) Performance was improved with the PointPlot vs the PointMarks, but not quite as much as I hoped. I think I'm using the APIs correctly but would welcome any feedback if not!
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to How to support foregroundColor (deprecated) and foregroundStyle in watchOS 9/10?
I think you've summarised the problem very well. The Nil Coalescing blog "Using foregroundColor(), foregroundStyle() or tint() to set text color in SwiftUI" explains well the differences between .foregroundColor and .foregroundStyle and makes it clear that the reason .foregroundColor otherwise still works it because it still return Text rather than View. It would be great to get some official guidance from Apple on this given we're now approaching WatchOS 11, everything is WidgetKit etc....
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to How long does Apple Watch keep HealthKit data?
UPDATE From testing on an Apple Watch Series 6 running WatchOS 11.0 Beta 1, it appears there are no significant changes to the availability of past Health data on Apple Watch. Unfortunately I've just found that in general you can only rely on the past 7 days of Health data being there. It could be that this changes in a later beta or it could be that the Series 6 Apple Watch (oldest supported by WatchOS 11) behaves differently to maybe 64GB Apple Watches such as the Ultra 2. Regardless, it's not something I would plan for or rely on in WatchOS 11. If you're still desperate for more Health data either consider a background task and caching it over time, or file a feedback and question how the new Vitals app and also Workout training loads achieve more Health access.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Migrating to WidgetKit, issues with editing Watch Faces on iPhone
I've submitted a fresh feedback for this following discussions in a WWDC lab. FB13879899 🙏🙏 This might get picked up this summer.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Crashes "[RenderBox] RB::Animation::size(RB::Animation::TermOrArg const*, unsigned long) EXC_BAD_ACCESS" on iOS 17
Further to my previous post in May providing the crash log and following a WWDC24 discussion with a DTS Engineer, I've since determined the crash I see on iOS 17.4 & 17.5 is unrelated to others in this post. We've determined my issue is likely an iOS/SwiftUI issue/bug rather than something I am able to fix. I've submitted a feedback FB13904299
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Apple Watch HealthKit Queries Beyond 7 Days?
I haven't got round to doing any testing yet but have a look here: https://developer.apple.com/forums/thread/732468
Replies
Boosts
Views
Activity
Jun ’24
Reply to How to use a WidgetBundle in @available(iOS ver, *)
Would something like this format help? import WidgetKit import SwiftUI @main struct AppWidgets { // Combine widgets in this way to prevent crashes. static func main() { if #available(iOSApplicationExtension 18.0, *) { WidgetsBundle18.main() } else { WidgetsBundle17.main() } } } @available(iOSApplicationExtension 18.0, *) struct WidgetsBundle18: WidgetBundle { var body: some Widget { NewWidget() } } struct WidgetsBundle17: WidgetBundle { var body: some Widget { OldWidget() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Any changes in HRV sample frequency in watchOS 11?
Just expanding on my previous comment... Apple Watch really lags behind in this area. Although it does record HRV data it simply doesn’t record enough to provide effective insights and trends to users. My app users are CONSTANTLY asking me how to record more HRV data, how to trigger a recording from my app and how to track it more effectively. This is all very difficult in WatchOS currently. I've filed a feedback FB13880126 and mentioned it at two WWDC labs. 🙏🙏 This might get picked up this summer.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Updating Widgets from StaticConfiguration to IntentConfiguration Requires Re-Installation
With all the new Intent based push and APIs... this seems like a glaring omission for developers who originally made more straightforward StaticConfiguration widgets and now want to upgrade them to more advanced and configurable IntentConfiguration ones. It seems that if I keep the same “kind” String identifier for the widget, they do migrate but only after a restart of the iPhone…. Until that point they just freeze and hang. This isn't really something I can ask my users to do.... I've filed a feedback: FB13880020 🙏🙏 This might get fixed for iOS 18.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Background Health Store Access for Lock Screen Widgets
@Thuri88 This looks like a fantastic suggestion, Thank You! I'll go ahead and implement this and do some testing. You mention Apple's activity rings Lock Screen widget implementing this.... I'm fairly sure I've observed it updating throughout the day without the iPhone being unlocked at all. There's also then the problem of StandBy mode and Widget on Mac which also can't update whilst your iPhone is locked.... and lots of my users would love to see their Health data in widgets on their Mac. I've filed a feedback again on this: FB13879739 🙏🙏 A solution may be offered one day.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Conditionally Migrate WatchOS 10 users ONLY to WidgetKit
For completeness I've filed another feedback here as this issue still plagues my users running WatchOS 9.6.3 New Feedback Number: FB13879553 Previous feedback: FB11989396, FB12818520, FB12818485 🙏🙏 This may one day get solved...
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to How to read Apple iOS 16 Heart Rate Zones from HealthKit
I've submit three past feedback (FB13879424 most recent) for this and mentioned it at three WWDC sessions. 🙏🙏 for a solution soon!
Replies
Boosts
Views
Activity
Jun ’24
Reply to The difference between @State private var and @State var?
It's good practice to always write @State private var This is because you should not declare a view and set the state within it's initialiser, it can cause the value to change undesirably when the view is redrawn. Use @Binding if you want to bind a variable to a view and make changes to it inside and outside of that view.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to How long does Apple Watch keep HealthKit data?
I believe this may have changed with WatchOS 11. Presumable this was done to allow for the new Vitals app and also Workout training loads to look at the longer 28 day trends and identify differences. I'll do some testing and try to come back with some actual available timescales for this against Health types: Heart Rate HRV Blood Oxygen Saturation Body Temperature Steps Activity Workouts Might take me a few weeks incase I have to have had WatchOS 11 installed for the elapsed time period to see the data!
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Migrating to WidgetKit, issues with editing Watch Faces on iPhone
No response. I've not seen so many reports from users of rat duplicate ClockKit and WidgetKit complications being offered. However, I'm still seeing rendering issues for complications in the Watch app Face Gallery tab. Some render, some don't, there seems to be no rhyme or reason. Tested on latest WatchOS 10.5 and iOS 17.5.1
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24