{"id":44202,"date":"2024-07-24T16:15:11","date_gmt":"2024-07-24T20:15:11","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=44202"},"modified":"2025-02-11T16:43:32","modified_gmt":"2025-02-11T21:43:32","slug":"swiftui-at-wwdc24","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2024\/07\/24\/swiftui-at-wwdc24\/","title":{"rendered":"SwiftUI at WWDC24"},"content":{"rendered":"<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10144\/\">What&rsquo;s new in SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10144\/\"><p>Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We&rsquo;ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10150\/\">SwiftUI essentials<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10150\/\"><p>Join us on a tour of SwiftUI, Apple&rsquo;s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you&rsquo;re brand new to SwiftUI or an experienced developer, you&rsquo;ll learn how to take advantage of what SwiftUI has to offer when building great apps.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10149\/\">Work with windows in SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10149\/\"><p>Learn how to create great single and multi-window apps in visionOS, macOS, and iPadOS. Discover tools that let you programmatically open and close windows, adjust position and size, and even replace one window with another. We&rsquo;ll also explore design principles for windows that help people use your app within their workflows.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10148\/\">Tailor macOS windows with SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10148\/\"><p>Make your windows feel tailor-made for macOS. Fine-tune your app&rsquo;s windows for focused purposes, ease of use, and to express functionality. Use SwiftUI to style window toolbars and backgrounds. Arrange your windows with precision, and make smart decisions about restoration and minimization.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10146\/\">Demystify SwiftUI containers<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10146\/\"><p>Learn about the capabilities of SwiftUI container views and build a mental model for how subviews are managed by their containers. Leverage new APIs to build your own custom containers, create modifiers to customize container content, and give your containers that extra polish that helps your apps stand out.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10151\/\">Create custom visual effects with SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10151\/\"><p>Discover how to create stunning visual effects in SwiftUI. Learn to build unique scroll effects, rich color treatments, and custom transitions. We&rsquo;ll also explore advanced graphic effects using Metal shaders and custom text rendering.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10073\/\">Catch up on accessibility in SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10073\/\"><p>SwiftUI makes it easy to build amazing experiences that are accessible to everyone. We&rsquo;ll discover how assistive technologies understand and navigate your app through the rich accessibility elements provided by SwiftUI. We&rsquo;ll also discuss how you can further customize these experiences by providing more information about your app&rsquo;s content and interactions by using accessibility modifiers.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10145\/\">Enhance your UI animations and transitions<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10145\/\"><p>Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10155\/\">Swift Charts: Vectorized and function plots<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10155\/\"><p>The plot thickens! Learn how to render beautiful charts representing math functions and extensive datasets using function and vectorized plots in your app. Whether you&rsquo;re looking to display functions common in aerodynamics, magnetism, and higher order field theory, or create large interactive heat maps, Swift Charts has you covered.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10207\/\">Migrate your TVML app to SwiftUI<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/videos\/play\/wwdc2024\/10207\/\"><p>SwiftUI helps you build great apps on all Apple platforms and is the preferred toolkit for bringing your content into the living room with tvOS 18. Learn how to use SwiftUI to create familiar layouts and controls from TVMLKit, and get tips and best practices.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/weekly.fatbobman.com\/p\/fatbobmans-swift-weekly-036\">Fatbobman<\/a>:<\/p>\n<blockquote cite=\"https:\/\/weekly.fatbobman.com\/p\/fatbobmans-swift-weekly-036\">\n<p>Starting with this version, the SwiftUI development team appears to have found the right path to rapidly evolve SwiftUI, exploring ways to enhance its capabilities while maintaining the characteristics of a declarative framework.<\/p>\n<p>In this update, the SwiftUI team changed its previous API design strategy&mdash;from highly encapsulated and less flexible designs to providing developers with greater lower-level control. This includes integrating UIKit gestures, introducing more functional custom containers, custom rendering of Text and providing precise scroll control. These improvements have significantly raised the upper limits of SwiftUI, opening up broader technical possibilities for advanced developers.<\/p>\n<p>As SwiftUI shares mechanisms for animations, transitions, and gestures with the UIKit framework, it is gradually transitioning from a framework built on UIKit\/AppKit to a more equal partner within Apple&rsquo;s UI framework ecosystem. It is no longer just drawing features from other frameworks but is starting to give back by contributing new features to them.<\/p>\n<p>The new version of the SwiftUI framework also underwent code-level stratification, carving out a separate SwiftUICore framework. This was likely done to facilitate better collaboration with UIKit and AppKit, but it also opens up exciting possibilities for future developments.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@colincornaby\/112594776754521028\">Colin Cornaby<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@colincornaby\/112594776754521028\">\n<p>SwiftUI has usually been thought of as an abstraction layer over AppKit and UIKit. But this WWDC is the first time I get the feeling AppKit and UIKit are becoming abstraction layers over SwiftUI.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/swiftwithmajid.com\/2024\/06\/10\/what-is-new-in-swiftui-after-wwdc24\/\">Majid Jabrayilov<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swiftwithmajid.com\/2024\/06\/10\/what-is-new-in-swiftui-after-wwdc24\/\"><p>SwiftUI introduced the new overloads for <code>Group<\/code> and <code>ForEach<\/code> views, allowing us to create custom containers like <code>List<\/code> or <code>TabView<\/code>.<\/p><p>[&#8230;]<\/p><p>The new <code>ScrollPosition<\/code> type, in pair with the <code>scrollPosition<\/code> view modifier, allows us to read the precise position of a <code>ScrollView<\/code> instance. We can also use it to programmatically scroll to the particular point of the scrolling content.<\/p><p>[&#8230;]<\/p><p>The new <code>Entry<\/code> macro allows us to quickly introduce environment values, focused values, container values, etc, without boilerplate.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/www.hackingwithswift.com\/articles\/270\/whats-new-in-swiftui-for-ios-18\">Paul Hudson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.hackingwithswift.com\/articles\/270\/whats-new-in-swiftui-for-ios-18\">\n<p>This is another good year for SwiftUI, with another batch of scrollview improvements, some welcome macOS features, remarkable control over text rendering, and more &#x2013; the team at Apple have a lot to be proud of, and many developers will breathe a sigh of relief as API such as fine-grained subview control is now public for all of us to use.<\/p>\n<p>[&#8230;]<\/p>\n<p>The difference is small, but makes a huge difference: the <code>@MainActor<\/code> attribute moved from <code>body<\/code> up to the [<code>View<\/code>] protocol itself, which means the <code>body<\/code> property <em>along with all other properties and methods we make<\/em> are run on the main actor.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@iKyle\/112594886106927818\">Kyle Howells<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@iKyle\/112594886106927818\">\n<p>After 5 years SwiftUI <code>ScrollView<\/code> finally gets one of the <a href=\"https:\/\/mastodon.notsobig.co\/@phill\/112594349801147009\">basic fundamental features<\/a> a <code>ScrollView<\/code> needs.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/swiftwithmajid.com\/2024\/07\/02\/mastering-scrollview-in-swiftui-scroll-phases\/\">Majid Jabrayilov<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swiftwithmajid.com\/2024\/07\/02\/mastering-scrollview-in-swiftui-scroll-phases\/\">\n<p>This week, we will discuss monitoring scroll phases in SwiftUI.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@clarko\/112617119171912936\">Clarko<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@clarko\/112617119171912936\">\n<p>The new <code>Entry<\/code> macro being backported is so wonderful.<\/p>\n<p>Immediately deleted a bunch of boilerplate from <code>EnvironmentValues<\/code> and <code>FocusedValues<\/code>.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/swiftwithmajid.com\/2024\/07\/09\/introducing-entry-macro-in-swiftui\/\">Majid Jabrayilov<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swiftwithmajid.com\/2024\/07\/09\/introducing-entry-macro-in-swiftui\/\">\n<p>This week, we will talk about the <code>Entry<\/code> macro type.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/talk.objc.io\/episodes\/S01E409-environment-preference-updates\">Swift Talk<\/a>:<\/p>\n<blockquote cite=\"https:\/\/talk.objc.io\/episodes\/S01E409-environment-preference-updates\">\n<p>Today, we want to discuss environment values, preferences, and view updates.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@dlx\/112594022303996247\">robb<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@dlx\/112594022303996247\"><p>There are some real crowd pleasers coming to SwiftUI this year at WWDC2024.<\/p><p>Here&rsquo;s the <a href=\"https:\/\/developer.apple.com\/documentation\/updates\/swiftui\">full list<\/a>, but I&rsquo;ll call out some personal favorites[&#8230;]<\/p>\n<p>[&#8230;]<\/p>\n<p><code>Group<\/code> and <code>ForEach<\/code> are getting superpowers this year, including the ability to iterate over and transform the subviews of a view. (No more <code>_VariadicView<\/code> shenanigans!)<\/p><\/blockquote>\n<p>This seems like the biggest change to me. I will be interested to hear how the performance is.<\/p>\n\n<p><a href=\"https:\/\/nilcoalescing.com\/blog\/RespondingToModifierKeys\/\">Matthaus Woolard<\/a>:<\/p>\n<blockquote cite=\"https:\/\/nilcoalescing.com\/blog\/RespondingToModifierKeys\/\"><p>New in macOS 15, we can now use <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/view\/onmodifierkeyschanged%28mask:initial:_:%29\">onModifierKeysChanged(mask:initial:_:)<\/a> to update our views when keyboard modifiers are held down.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@tolmasky\/112593854910550941\">Francisco Tolmasky<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@tolmasky\/112593854910550941\"><p>&ldquo;If we just keep saying SwiftUI is the best way to write apps it&rsquo;ll eventually come true, right?&rdquo;<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@stroughtonsmith\/112594639473546088\">Steve Troughton-Smith<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@stroughtonsmith\/112594639473546088\">\n<p>You can now build AppKit <code>NSMenus<\/code> in SwiftUI with the <code>NSHostingMenu<\/code> API.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/krzyzanowskim\/status\/1800268063641682411\">Marcin Krzyzanowski<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/krzyzanowskim\/status\/1800268063641682411\">\n<p>I had some hopes that Apple would embrace new Swift concurrency in their API for a Swift 6 launch. I guess not necessarily, if not even modern SwiftUI API got update.<\/p>\n<p>It&rsquo;s going fine: <code>@preconcurrency<\/code>, <code>@unchecked Sendable<\/code><\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/DLX\/status\/1800259031161803111\">Robb B&ouml;hnke<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/DLX\/status\/1800259031161803111\">\n<p>SwiftUI&rsquo;s new <code>Color.mix(with:by:)<\/code> API allows you to interpolate <code>Color<\/code>s that match <code>SwiftUI.Gradient<\/code> in discrete steps.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/onmyway133\/status\/1800983349390885356\">Khoa<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/onmyway133\/status\/1800983349390885356\">\n<p>The new SwiftUI <code>Window<\/code> modifier for macOS is great. There is less need for AppKit now<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/CoreSerena\/status\/1800622427510370690\">Antoine<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/CoreSerena\/status\/1800622427510370690\"><p>I&rsquo;m DYING to know why can&rsquo;t SwiftUI just give you the <code>NSWindow<\/code> so we don&rsquo;t have to wait years for them to add the most basic stuff<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/RonAvitzur\/status\/1801250329079775708\">Ron Avitzur<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/RonAvitzur\/status\/1801250329079775708\"><p>I submitted FB13821655 June 9, 2024 &ldquo;Support onboarding View for iOS SwiftUI document-based apps&rdquo; and received response from Apple June 12, 2024 saying &ldquo;The API you&rsquo;re asking for has been released in a new Beta now. Here&rsquo;s the WWDC session that covers it.<\/p><p>This wins both the &ldquo;Fastest response to a Feedback feature request&rdquo; and the &ldquo;Most useful response&rdquo; awards by a long mile.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/iosdev.space\/@babbage\/112605538816290770\">Duncan Babbage<\/a>:<\/p>\n<blockquote cite=\"https:\/\/iosdev.space\/@babbage\/112605538816290770\">\n<p>Would love any leads on this: setting [Core Data] <code>.fetchBatchSize<\/code> causes entire collection to be immediately traversed [by SwiftUI].<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@helge\/112609069445110101\">Helge He&szlig;<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@helge\/112609069445110101\">\n<p>Did someone try whether the SwiftUI refresh issue in SwiftData got fixed? Some blog sounded like no?<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/iosdev.space\/@sanguish\/112620134200523949\">Scott Anguish<\/a>:<\/p>\n<blockquote cite=\"https:\/\/iosdev.space\/@sanguish\/112620134200523949\">\n<p>Just realized, SwiftUI views still can&rsquo;t just print. I can&rsquo;t believe another year went by without that.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/x.com\/DamienPetrilli\/status\/1801858253648810441\">Damien Petrilli<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/DamienPetrilli\/status\/1801858253648810441\">\n<p>5y into SwiftUI, still no justify <code>Text<\/code> alignment.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/nilcoalescing.com\/blog\/FormSheetInSwiftUI\/\">Natalia Panferova<\/a>:<\/p>\n<blockquote cite=\"https:\/\/nilcoalescing.com\/blog\/FormSheetInSwiftUI\/\"><p>For a while, presenting a form sheet in SwiftUI, equivalent to the <a href=\"https:\/\/developer.apple.com\/documentation\/uikit\/uimodalpresentationstyle\/formsheet\">UIModalPresentationStyle.formSheet<\/a>, was a challenge. Now, with the new <a href=\"https:\/\/developer.apple.com\/documentation\/SwiftUI\/View\/presentationSizing%28_%3A%29\">presentationSizing()<\/a> modifier, we can easily achieve this using the <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/presentationsizing\/form\">form<\/a> sizing option.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@andyfinnell\/112660935782503579\">Andy Finnell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@andyfinnell\/112660935782503579\">\n<p>I feel like SwiftUI&rsquo;s <code>Form<\/code> should have been an exemplar of the power and ease-of-use of declarative UI code. It instead its a demonstration of the pitfalls.<\/p>\n<p>The same code doesn&rsquo;t adapt correctly across platforms. When layout goes wrong, it&rsquo;s not clear how to fix it or if it can even be fixed.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/developer.apple.com\/forums\/thread\/757229\">alfamsome2<\/a>:<\/p>\n<blockquote cite=\"https:\/\/developer.apple.com\/forums\/thread\/757229\">\n<p>I have a simple SwiftUI app that has a picker, textfield and several buttons. It is using a Enum as a focus state for the various controls. When I compile and run it on Mac Studio desktop it works as expected: Picker has initial focus, Selection in Picker changes focus to TextField, Tab key moves through buttons; last button resets to Picker<\/p>\n<p>However when I run the exact same app on MacBook Pro (same version of MacOS, 14.5) it does not work at all as expected. Instead: Initial focus is set to TextField, Tab does not change the focus, Clicking on last button resets focus to TextField rather than Picker.<\/p>\n<\/blockquote>\n\n<p>[Update (2024-07-25): It <a href=\"https:\/\/mjtsai.com\/blog\/2024\/07\/24\/swiftui-at-wwdc24\/#comment-4133635\">turns out<\/a> that this was due to a <a href=\"https:\/\/developer.apple.com\/forums\/thread\/757229?answerId=791325022#791325022\">different system setting<\/a>.]<\/p>\n\n<p><a href=\"https:\/\/mastodon.social\/@andyfinnell\/112660947087860518\">Andy Finnell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@andyfinnell\/112660947087860518\">\n<p>Xcode previews would be super-helpful in iterating over <code>Form<\/code>s. However, I also discovered if my SwiftUI <code>View<\/code> uses macros to generate any of its code, previews don&rsquo;t work at all. Doesn&rsquo;t matter if I build them old-school or use the <code>#\\Preview<\/code> macro.<\/p>\n<p>Maybe the new preview system in Xcode 16 fixes this?<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@andyfinnell\/112740139949628185\">Andy Finnell<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@andyfinnell\/112740139949628185\">\n<p>For all of Swift&rsquo;s rich static typing, SwiftUI doesn&rsquo;t seem able to leverage it in ways that would make it ergonomic. Everything gets erased to a <code>View<\/code>, effectively. There&rsquo;s no typing to hint at what <code>View<\/code>s would work in a specific context, or type errors about invalid combinations.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/chaos.social\/@ole\/112620782611792350\">Ole Begemann<\/a>:<\/p>\n<blockquote cite=\"https:\/\/chaos.social\/@ole\/112620782611792350\">\n<p>If you want to go spelunking in SwiftUI&rsquo;s <tt>.swiftinterface<\/tt> file (people have found interesting things in there in past years), note that there&rsquo;s a new <tt>SwiftUICore.framework<\/tt> this year, so now there&rsquo;s two files to check.<\/p>\n<pre>\/Applications\/Xcode-16.0b1.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/SDKs\/iPhoneOS.sdk\/System\/Library\/Frameworks\/SwiftUICore.framework\/Modules\/SwiftUICore.swiftmodule\/arm64-apple-ios.swiftinterface<\/pre>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@krzyzanowskim\/112778998519741961\">Marcin Krzyzanowski<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@krzyzanowskim\/112778998519741961\">\n<p>My beef about today&rsquo;s Swift adoption at Apple is SwiftUI. It is a framework that stands against what Swift promised to developers back in the days<\/p>\n<ul>\n\t<li>slow<\/li>\n\t<li>limited<\/li>\n\t<li>runtime crashes if you use the wrong variable type (compile and don&rsquo;t work?)<\/li>\n\t<li>unhelpful\/misleading compilation diagnostics<\/li>\n\t<li>underlying objc frameworks crash and mem leak as it always been<\/li>\n\t<li>bad devtools that never improved<\/li>\n<\/ul>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@stroughtonsmith\/112611905858160078\">Steve Troughton-Smith<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@stroughtonsmith\/112611905858160078\"><p>With SwiftUI entering its sixth year, with Apple having now revealed what this year&rsquo;s change cycle will be, I haven&rsquo;t seen anything that moves the needle re adopting it in existing apps if you&rsquo;ve been holding off. It&rsquo;s certainly improving for SwiftUI developers, and it&rsquo;s getting carve-outs for things that have been pain points traditionally like gesture recognizers, but it doesn&rsquo;t feel like an essential capital-t Transition, just a different way to make apps if that&rsquo;s how you prefer it<\/p><\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/07\/18\/overcasts-new-foundation\/\">Overcast&rsquo;s New Foundation<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/07\/22\/swift-6-announced\/\">Swift 6 Announced<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/07\/17\/xcode-16-announced\/\">Xcode 16 Announced<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/06\/13\/catalyst-not-at-wwdc24\/\">Catalyst (Not) at WWDC24<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/04\/15\/nstableview-with-swiftui\/\">NSTableView With SwiftUI<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2024\/03\/11\/mac-dialog-in-auto-layout-vs-swiftui\/\">Mac Dialog in Auto Layout vs. SwiftUI<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/08\/11\/appkit-vs-swiftui-stable-vs-shiny\/\">AppKit vs. SwiftUI: Stable vs. Shiny<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/05\/30\/swiftui-notes-before-wwdc-2023\/\">SwiftUI Notes Before WWDC 2023<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2022\/08\/16\/slow-swiftui-closure-actions\/\">Slow SwiftUI Closure Actions<\/a><\/li>\n<\/ul>\n\n<p id=\"swiftui-at-wwdc24-update-2024-08-07\">Update (2024-08-07): <a href=\"https:\/\/mastodon.social\/@pasi@infosec.exchange\/112853687283067720\">Pasi Salenius<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@pasi@infosec.exchange\/112853687283067720\"><p>SwiftUI is a big part of why I feel like I want to switch from iOS to Android.<\/p><p>Yes Apple uses it all over, and most apps where they use it seem buggy, behave in weird ways, often lack animations and transitions that used to be there, or just look odd.<\/p><p>SwiftUI lists still don&rsquo;t smoothly scroll anything that has more than 10 rows in it. Yes it&rsquo;s easier but the apps people build with it end up being worse for the user.<\/p><p>This is not the Apple that I was enamored by years ago.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/infosec.exchange\/@pasi\/112892054884748943\">Pasi Salenius<\/a>:<\/p>\n<blockquote cite=\"https:\/\/infosec.exchange\/@pasi\/112892054884748943\"><p>[I] meant to say discoverability.  By that I mean the ergonomics of writing SwiftUI, how it boils down to knowing modifiers that one just has to remember as autocomplete is crushed under the load of everything being available everywhere. And the order of those modifiers matters in myriad ways. And the fact that Apple keeps changing the modifiers every year just when you thought you might even remember the previous ones.<\/p><p>[&#8230;]<\/p><p>I went pretty far trying to implement Proxygen on Mac with SwiftUI and it performed horribly scrolling through even a relatively small number of rows. It doesn&rsquo;t really matter if developers are doing something wrong or it&rsquo;s SwiftUI&rsquo;s fault, but scrolling performance is bad in almost any SwiftUI app you see. Latest example is Overcast (sorry Marco).<\/p><p>You must have seen the troubles Icecubes has gone through trying to get an app whose only task is to scroll smoothly to do that. And it never succeeded. This was supposed to be the shining pinnacle of what a good SwiftUI app can be like. And the developer lost hope getting it to work.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@helge\/112892326903952923\">Helge He&szlig;<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@helge\/112892326903952923\"><p>I think of SwiftUI as being a &ldquo;form builder on steroids&rdquo;. You can very quickly build quite advanced forms or viewers. I absolutely do agree that it is unsuitable for a scrollable list of thousands of items. For a settings form, it is great.\nBut this gets me to another huge advantage of SwiftUI over other declarative frameworks: It has a very good Cocoa integration. So you <em>can<\/em> easily step out to Cocoa to do performance sensitive things. That&rsquo;s a feature not a bug.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@helge\/112893831132340039\">Helge He&szlig;<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@helge\/112893831132340039\"><p>SwiftUI is very fast at layout (much faster than AutoLayout) and also faster at drawing (depending a little on what you draw).<\/p><p>The real achilles heel of SwiftUI is the diffing that has to be performed, and which, like AutoLayout, doesn&rsquo;t scale at all.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@bigzaphod\/112889128758418993\">Sean Heber<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@bigzaphod\/112889128758418993\"><p>A weird perception(?) problem with SwiftUI is that it&rsquo;s easy to bang out whole entire rough UIs in a day or two that used to take weeks but then you gotta do polish and edge cases and that still takes forever except because that initial blocking out phase was so quick, when a single small polish thing takes a week or two to iron out it feels like nothing is getting done and the pressure builds unnecessarily.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@high_lander\/112889272368494980\">Highlander<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@high_lander\/112889272368494980\">\n<p>If I want quality, I need to control. If I want to control, SwiftUI is not the answer.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/github.com\/lemonmojo\/swiftui-hierarchical-list-performance\">Felix Deimel<\/a>:<\/p>\n<blockquote cite=\"https:\/\/github.com\/lemonmojo\/swiftui-hierarchical-list-performance\"><p>This is a demo project that highlights performance issues with <a href=\"https:\/\/developer.apple.com\/documentation\/swiftui\/list#Creating-hierarchical-lists\">hierarchical SwiftUI lists<\/a>.<\/p><p>There are three main problems:<\/p><ol><li>Rendering of the list is slow if there are many items. (Just start the app and wait for the list to be rendered.)<\/li><li>Changing the selected item is very slow. (Tap\/Click an item and wait for the selection to change.)<\/li><li>Updating the list is slow. (Press the &ldquo;Shuffle&rdquo; button.)<\/li><\/ol>\n<p>[&#8230;]<\/p>\n<p>All three problems are much more pronounced on macOS (tested on a Mac Studio M2) where it even takes minutes(!) for the app to become responsive.<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@chockenberry\/112922127364720830\">Craig Hockenberry<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@chockenberry\/112922127364720830\">\n<p>Just discovered an issue that causes SwiftUI to crash on macOS because you change the size of a window.<\/p>\n<p>A <code>ScrollView<\/code> that gets a width change because its content <code>View<\/code> height is &ldquo;just right\" to cause scroll bars to appear will cause AppKit to throw an exception because of overlapping constraint changes.<\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2024-08-14\">Update (2024-08-14): <a href=\"https:\/\/mastodon.social\/@a_grebenyuk\/112938142062976497\">Alex Grebenyuk<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@a_grebenyuk\/112938142062976497\"><p>It&rsquo;s also a shame SwiftUI gets a bad rep because folks keep trying to make <code>List<\/code> work&mdash;it does only as long as you never need to scroll or update it.<\/p><p>[&#8230;]<\/p><p>if you need to dipslay more than 10 items, <code>UITableView<\/code> or <code>UICollectionView<\/code> with <code>UIHostingConfiguration<\/code> is the way to go for now.<\/p><\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2024-08-22\">Update (2024-08-22): <a href=\"https:\/\/troz.net\/post\/2024\/swiftui-mac-2024\/\">Sarah Reichelt<\/a> (<a href=\"https:\/\/news.ycombinator.com\/item?id=41318000\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/troz.net\/post\/2024\/swiftui-mac-2024\/\">\n<p>I&rsquo;ll cover new features from both WWDC 2023 and WWDC 2024.<\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2024-11-19\">Update (2024-11-19): <a href=\"https:\/\/coreint.org\/2024\/11\/episode-620-i-just-kept-hitting-walls\/\">Core Intuition<\/a>:<\/p>\n<blockquote cite=\"https:\/\/coreint.org\/2024\/11\/episode-620-i-just-kept-hitting-walls\/\">\n<p>Manton relates his recent attempts to write a new app in SwiftUI, which leads to an assessment of whether SwiftUI is ready for prime-time on iOS and\/or Mac. <\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2024-12-03\">Update (2024-12-03): <a href=\"https:\/\/mastodon.social\/@woolie\/113583787913074065\">Steven Woolgar<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@woolie\/113583787913074065\">\n<p>After seeing an implementation of a very important app on macOS using SwiftUI, I remain convinced that it is not ready to ship apps with. Text field editing is not ready. The engineer in question is very good and senior. Sigh.<\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2025-01-13\">Update (2025-01-13): <a href=\"https:\/\/x.com\/oskargroth\/status\/1877870355995373771\">Oskar<\/a> <a href=\"https:\/\/mastodon.social\/@oskargroth\/113806814193381791\">Groth<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/oskargroth\/status\/1877870355995373771\"><p>I&rsquo;ve reached a point where I&rsquo;ve started to shift away from SwiftUI and SwiftUI App Lifecycle back to AppKit-first development. Working on a big update to Backdrop that includes a partial AppKit rewrite, with a new design and much better performance.<\/p><\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2025-01-16\">Update (2025-01-16): <a href=\"https:\/\/mastodon.social\/@stroughtonsmith\/113833445143176875\">Steve Troughton-Smith<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@stroughtonsmith\/113833445143176875\">\n<p>Boy do I wish Apple had built a real Apple-quality next-gen UIKit\/AppKit-like first-party cross-[Apple]-platform UI framework instead of SwiftUI. The closest thing Apple makes is still Catalyst, but they completely squandered their opportunity to make something <em>better<\/em> than what came before. Going all-in on SwiftUI is the kind of mistake that will hurt for decades to come.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/sfba.social\/@MyLittleMetroid\/113833859781983783\">&Oacute;scar Morales Viv&oacute;<\/a>:<\/p>\n<blockquote cite=\"https:\/\/sfba.social\/@MyLittleMetroid\/113833859781983783\">\n<p>The whole declarative thing makes more sense to me as a replacement for Interface Builder (which never worked that great for iOS and has been bit rotting away for quite a while) than for the whole thing.<\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2025-01-24\">Update (2025-01-24): <a href=\"https:\/\/mastodon.social\/@marcedwards\/113846483023446237\">Marc Edwards<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@marcedwards\/113846483023446237\">\n<p>SwiftUI will be six years old this June. How do you feel about it? Is it likely to survive another couple of decades, or do we need another reboot and new approach to UI?<\/p>\n<\/blockquote>\n\n<p id=\"swiftui-at-wwdc24-update-2025-02-11\">Update (2025-02-11): <a href=\"https:\/\/x.com\/vatsal_manot\/status\/1886907772362744289\">Vatsal Manot<\/a>:<\/p>\n<blockquote cite=\"https:\/\/x.com\/vatsal_manot\/status\/1886907772362744289\">\n<ul>\n<li>Poor scroll performance <\/li>\n<li>Random glitching of cell-like elements<\/li>\n<li>Poor text(field|editor) sizing\/focus interactions <\/li>\n<li>Navigation bar titles\/items flickering in <\/li>\n<li>Poor state restoration <\/li>\n<\/ul>\n<p>&#8230; are a few points to start for iOS SwiftUI apps. For macOS the list is much longer.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>What&rsquo;s new in SwiftUI: Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We&rsquo;ll also take [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-07-24T20:15:16Z","apple_news_api_id":"3991497d-5dc1-4b49-a519-45e250b7a604","apple_news_api_modified_at":"2025-02-11T21:43:37Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAADQ==","apple_news_api_share_url":"https:\/\/apple.news\/AOZFJfV3BS0mlGUXiULemBA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[930,109,31,2586,30,2598,71,2200,901,1812],"class_list":["post-44202","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-accessibility","tag-coredata","tag-ios","tag-ios-18","tag-mac","tag-macos-15-sequoia","tag-programming","tag-swift-concurrency","tag-swift-programming-language","tag-swiftui"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/44202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=44202"}],"version-history":[{"count":15,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/44202\/revisions"}],"predecessor-version":[{"id":46705,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/44202\/revisions\/46705"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=44202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=44202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=44202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}