1/ There is something deeply comforting when you struggle all day trying to find a solution for a problem only to discover that Apple couldn't/didn't solve it either.
I was trying to create a SwiftUI chart which could smoothly animate between different zoom levels (month, week, year) while keeping the users viewport on a similar date range. I'm pretty sure this isn't possible (even with the new iOS 18 scrollview stuff).
You can sort of get it in on the ends but not smoothly everywhere.
…
=> More informations about this toot | More toots from _Davidsmith@mastodon.social
2/ I remembered Apple Health has a similar view, so I checked how they did it (realizing it might be a UIKit UIScrollView thing which would give you way more control).
Analyzing slo-mo footage of their switching I discovered they actually just kinda "cheat" and swap out a replacement chart which either animates from slightly wider or narrower than the final result. Which is a delightfully clever approach to a really tricky problem. Visually similar to a full solution but much simpler.
[#]##
=> More informations about this toot | More toots from _Davidsmith@mastodon.social
@_Davidsmith ai wonder if there's something like D3.js, but for SwiftUI
=> More informations about this toot | More toots from agarrharr@mstdn.social
@_Davidsmith I too have recorded slow videos of apps to reverse engineer how they do certain animations 👌🏼
=> More informations about this toot | More toots from djpeacher@fosstodon.org
@_Davidsmith Worse is Better :)
=> More informations about this toot | More toots from easeout@mastodon.social
@_Davidsmith Reminds me of Android's MaterialSharedAxis transition. I love how a subtle animation can do so much! This probably originated with older Android phones not being able to do long fullscreen animations smoothly but this is so much a "less is more" for me.
=> More informations about this toot | More toots from bgeerdes@mastodon.cloud
@_Davidsmith Interactive Charts in Health long predate SwiftUI :)
=> More informations about this toot | More toots from technophobe@mastodon.xyz This content has been proxied by September (ba2dc).Proxy Information
text/gemini