fatbobman / blogComments

1 stars 0 forks source link

SwiftUI 滚动控制 API 的演变:一个微观视角下的宏观设计趋势 #240

Open fatbobman opened 3 weeks ago

fatbobman commented 3 weeks ago

SwiftUI 滚动控制 API 的发展历程与 WWDC 2024 的新亮点

https://fatbobman.com/zh/posts/the-evolution-of-swiftui-scroll-control-apis/ 在 WWDC 2024 中,苹果再次为 SwiftUI 的 ScrollView 组件带来了一系列令人瞩目的新 API。这些新功能不仅增强了开发者对滚动行为的控制能力,也反映了 SwiftUI 框架设计理念的持续演进。本文将探讨这些最新的滚动控制 API,并回顾从 SwiftUI 诞生至今与滚动控制相关的所有重要 API 的发展历程。通过这个微观视角,我们将揭示 SwiftUI 在过去几年中设计风格的变迁,以及背后蕴含的宏观设计趋势。

The Evolution of SwiftUI Scroll Control APIs and Highlights from WWDC 2024

https://fatbobman.com/en/posts/the-evolution-of-swiftui-scroll-control-apis/ At WWDC 2024, Apple once again introduced a series of remarkable new APIs for SwiftUI's ScrollView component. These new features not only enhanced developers' ability to control scrolling behaviors but also reflected the ongoing evolution of the SwiftUI framework's design philosophy. This article will explore these latest scroll control APIs and review the development of all significant APIs related to scroll control since the inception of SwiftUI. Through this micro view, we will reveal the changes in SwiftUI's design style over the past few years and the underlying macro design trends.

mark-onyschuk commented 2 weeks ago

Despite Apple’s significant enhancement of scroll-related API functionalities in 2023, they once again exceeded developers’ expectations at WWDC 2024,

No, they did not exceed developer expectations... they're falling terribly short. They're playing catch-up with desktop devs - they're moving phone APIs to Macs and imagining that it's sufficient, when there's an entire richness of app behavior on desktop that has existed for decades and hasn't been cracked with this now "not so new" API.

I don't know if Apple simply hasn't got enough macOS engineers anymore - the sort that used to be around like Ali Ozer from the Text Kit world - but SwiftUI feels like an afterthought on desktop, even after all of these years.

To create a first-class desktop app, you're going to have to break out of SwiftUI back into AppKit pretty quick; and it's shameful that after all of these years, whole classes of behavior just aren't supported for macOS in that toolkit...

fatbobman commented 2 weeks ago

@mark-onyschuk Despite Apple’s significant enhancement of scroll-related API functionalities in 2023, they once again exceeded developers’ expectations at WWDC 2024,

No, they did not exceed developer expectations... they're falling terribly short. They're playing catch-up with desktop devs - they're moving phone APIs to Macs and imagining that it's sufficient, when there's an entire richness of app behavior on desktop that has existed for decades and hasn't been cracked with this now "not so new" API.

I don't know if Apple simply hasn't got enough macOS engineers anymore - the sort that used to be around like Ali Ozer from the Text Kit world - but SwiftUI feels like an afterthought on desktop, even after all of these years.

To create a first-class desktop app, you're going to have to break out of SwiftUI back into AppKit pretty quick; and it's shameful that after all of these years, whole classes of behavior just aren't supported for macOS in that toolkit...

Indeed, SwiftUI's support for macOS is still unsatisfactory. Not only does it lack functionality, but its performance optimization also falls far short of the iOS platform. I completely agree with this point.

mark-onyschuk commented 2 weeks ago

@fatbobman

@mark-onyschuk Despite Apple’s significant enhancement of scroll-related API functionalities in 2023, they once again exceeded developers’ expectations at WWDC 2024,

No, they did not exceed developer expectations... they're falling terribly short. They're playing catch-up with desktop devs - they're moving phone APIs to Macs and imagining that it's sufficient, when there's an entire richness of app behavior on desktop that has existed for decades and hasn't been cracked with this now "not so new" API.

I don't know if Apple simply hasn't got enough macOS engineers anymore - the sort that used to be around like Ali Ozer from the Text Kit world - but SwiftUI feels like an afterthought on desktop, even after all of these years.

To create a first-class desktop app, you're going to have to break out of SwiftUI back into AppKit pretty quick; and it's shameful that after all of these years, whole classes of behavior just aren't supported for macOS in that toolkit...

Indeed, SwiftUI's support for macOS is still unsatisfactory. Not only does it lack functionality, but its performance optimization also falls far short of the iOS platform. I completely agree with this point.

Thanks @fatbobman - I'm sure we were talking at different levels of resolution here. I'd really hoped that at least by this WWDC, we'd see some genuinely significant updates to SwiftUI for macOS behavior, but it seems we've got another year to wait.

I frankly think that at this point, it's never going to happen. If any company could come up with a "highest common denominator" approach to merging multiple APIs, especially with SwiftUI's approach of just #if os(<#insert OS here#>) then it would be Apple. That they haven't managed to do this by now seems indicative that they're basically incapable of doing it...

StewartLynch commented 1 week ago

I think you will run into a problem with your sample code where you cover the new ScrollPosition. You have a view called ScrollPosition and that will conflict with the ScrollPosition struct

fatbobman commented 1 week ago

@StewartLynch Thanks! I have changed the name of View.