WWDC 2022: Lessons from the SwiftUI Digital Lounges

This has been the second year of WWDC Digital Lounges. They gave us a good opportunity to try getting our questions directly answered by the makers of SwiftUI (and other frameworks).

Not everyone has been able to attend, probably due to other commitments, lack of time, failure to register, unfortunate timezones, etc. However, again this year, I took my notes before the channel is taken down (at the moment it’s still available). I asked permission to share these with you, and fortunately they had no issue with it.

I have categorized, curated, and in some cases commented the SwiftUI Digital Lounge questions. For better and faster browsing, I simplified many of the questions to one (or two) lines. Still, the original text can be found inside. I have also removed all names, just in case someone is uncomfortable with it.

If you want to share a question, you may use the hash button at the bottom of each question. It will copy a link to the clipboard. Using this link will load the page, scroll to the question, and expand it.

In some of the questions, I added my own comments, by either expanding on the topic, or appending an example of what is discussed. These questions are marked with 💬.

When a question is related to a new feature introduced in WWDC ’22, I flagged it with a ♦️ symbol.

I also put a ⭐️ mark, on those questions that I found particularly interesting. Some of the reasons why a question gets the star are:

  1. The answer provides a brand new piece of information.
  2. The answer from Apple confirms something we suspected for a long time, but wasn’t documented anywhere.
  3. The answer from Apple confirms a pattern we’ve adopted in the community, but not seen used by Apple until now.
  4. The question discusses a topic rarely treated and deserves some attention.
  5. The answer provides some insight into the inner workings of the framework.
  6. The answer provides design/coding recommendations.
  7. Or just any other question that made me stop to think 🤔

In some cases, Apple engineers have provided tips that are not related to any specific questions. These have been marked with the 💡 symbol.

After the WWDC, with new betas, some of the answers in here are no longer valid. The cases I detected are marked with ⚠️ and I provide additional comments.

This is not a full transcript of the lounges. Not all questions made it to this page, although a very large number did. Some of them were just too specific to a user’s project, or simply addressed a very well documented and repeatedly discussed topic, others questions I may have filtered because they were either vague or their answer was vague. The lounges are a great part of the WWDC, but because its scopes everything, sometimes things can get lost in there. The idea was to make this page easy to read and reduce as much noise as possible.

If you are looking for last year’s digital lounges questions, you can find them here.

Backwards Compatibility

Are any of this year’s changes backward compatible? ♦️

Is it possible to use SwiftUI Navigation for iOS 15? How can we transition to it on the existing project? ♦️

Are there macOS cases that you would recommend using AppKit rather than SwiftUI? ⭐️

What is the recommended way to conditionalize code for view modifiers that are only available on newer versions of iOS? 💬

Charts

Are doughnut and pie charts also supported? ♦️

Can it be used to show realtime (e.g., sensor) data? ♦️

Any hierarchy tree type charts? ♦️

Any support for rendering this to a scalable PDF beyond embedding as an image? ♦️💬

Do we get the Audio Charts for free when using native charts? ♦️

Custom Grids vs Swift Charts. Which one is better in this case? ♦️

Are charts interactive? ♦️

Is it be possible to add a gradient color filling the area underneath the line in a line chart? ♦️

Can the new Charts API allow for scrolling? Similar to the health app’s charts. ♦️

Could we utilize a scrollview and a chart to display a live chart? ♦️ ⭐️

How would one go about creating a Bubble Chart with Swift Charts? ♦️

How to balance large data sets and performance ♦️ ⭐️

Can Swift Charts be adapted for non-discrete data, like curves, etc? ♦️💬

Is there any sample code or documentation on how to display vector fields with Swift Charts? ♦️ ⭐️ 💬

How easy is it to support interactions like pan-to-move and pinch-to-zoom? ♦️ ⭐️

Is there multiple axis support? Logarithmic axis support? ♦️

Is there a way to have multiple scales per chart? ♦️

Is there a method to modify or specify the label style of a chart? ♦️

Does Charts support polar coordinates?♦️

How can I add a text or SF Symbol at the top of a vertical BarMark? ♦️

Can we transform a mark when the user presses and releases it? ♦️

What’s the best way to that we can use Swift Charts in a predominately UIKit app? ♦️

Controls

Is it possible to provide custom form styles? ♦️

Does the grouped formStyle work in Mac Catalyst SwiftUI? ♦️

Tip: Accessibility Quick Actions on watchOS 💡 ♦️

Tip: Avoiding tap gestures with button-like elements. 💡 ♦️

Is there any difference in terms of performance about using Table instead of List on iOS? ♦️⭐️

Is it possible to set default focus on TextField when it appeared first time? ♦️

What is the best way to resign (text field) focus from some distant view in the view hierarchy? ⭐️

Can the new multiple date picker be used to choose date ranges? ♦️

Is there a way to use a capacity `Gauge` outside of the lock screen? ♦️

Advantages of .buttonStyle(MyCustomStyle()) vs. MyCustomButton(…) ⭐️

How can I control how the focus moves around the controls of my view when I press “tab”? ♦️

Is it possible to make Form controls look more native on a macOS app made with Catalyst? ♦️ ⭐️

Data Modeling

How to implement invalidation when conforming to DynamicProperty? ⭐️

Is it possible to prevent DynamicProperty invalidation? ⭐️

What is the use of DynamicProperty’s update method? ⭐️

Extending @State and @Environment ⭐️

What are best practices to avoid state changes affecting unnecessary views?

Why would anyone use observable object instead of state object?

Are there any changes to Core Data/SwiftUI integration this year? ♦️

SceneStorage not working on simulator ♦️ ⭐️

How does objectWillChange coordinates with view updates? ⭐️

is there any way to get my offscreen nested StateObjects to not be deallocated when scrolled offscreen within a Lazy*Stack? ⭐️

Clearing up controversy on ObservedObject(wrappedValue:) ⭐️

Is using @EnvironmentObject for dependency injection of entities not directly related to the view state, considered bad practice? ⭐️

With the new “any” keyboard, will be still need AnyView? ♦️ ⭐️

What’s the recommended way to repeatedly fetch data in a SwiftUI app? ⭐️

How can I tune performance, if my whole app state is in the state object of my app struct? ⭐️

Do ids in a ForEach just need to be unique within that ForEach or globally? ⭐️

Making sense of _printChanges() output ⭐️

Concurrency and SwiftUI ⭐️

Is it bad to break down views? ⭐️

What is the difference between onChange() and onReceive? ⭐️

Graphics and Animations

Tip: Power of shadows ♦️ 💡⭐️ 💬

What elements of font animations interpolate? ♦️ ⭐️

What is best? Storing a View or a closure? ⭐️

How do I actually apply Variable Color to an SF Symbol along with the percentage I want highlighted vs dimmed?

What is the advantage of using custom Symbols rather than SVG with `template` rendering mode? ⭐️

Is it possible to create an infinite page collection view? ⭐️

Will .foregroundColor(.white.shadow(…))  work with custom PNGs/SVGs as well? ♦️ ⭐️

Is there a way of disabling scrolling on a List? ♦️

Navigation: Split Views

Is NavigationView deprecated? ♦️

Can an object class (such as an NSManagedObject) be used for the navigation destination data? ♦️

Can a NavigationLink activation be detected without access to the stack path? ♦️

Can NavigationStack work with custom matchedGeometryEffect animations? ♦️

Is it possible enumerate a NavigationPath or replace certain elements? ♦️ ⭐️

How to hide the disclosure indicator of a NavigationLink

Can we set the NavigationPath from onContinueUserActivity and onOpenURL? ♦️

Is there a way to show a preview of a view when the user taps and holds on a NavigationLink? ♦️

Is it possible to navigate from SwiftUI view to UIViewController? ⭐️ ♦️

Are deep links possible? Do they work well? Are there limitations compared to what is possible with UIKit? ♦️ ⭐️

When using NavigationView, is there a way to start the app with a the sidebar already collapsed (or do it programmatically)? ♦️

Navigation: Stack Views

Can split view panels have different priorities? ♦️

Does NavigationSplitView support the sidebar on the right? ♦️

NavigationView issues when switching from split style to stack style. Does the new API fix it? ♦️

Preserving state when switching to a new destination ♦️

Is there anything different visually, to the user, between a NavigationView and a NavigationStack? ♦️ ⭐️

Is it possible to switch between two-column and three column layout depending on sidebar selection? ♦️

Is there a modifier to prevent a ForEach list collapsing? ♦️

What is recommended way to style navigation bar in SwiftUI? ♦️

Is it ok to pass NavigationPath down to child views as a @Binding or @EnvironmentObject? ♦️ ⭐️

Is it possible with SwiftUIs new NavigationStack to hide the tab bar of a TabView when the destination view appears? ♦️

New Grids

Can Grid cells span rows and columns? ♦️

Does Grid replace LazyVGrid? ♦️ ⭐️

Are there any special considerations needed when putting a Grid inside a ScrollView? ♦️

Can a cell span partial columns in a Grid? ♦️

New Layout Protocol

When should we use custom layouts vs native elements. When to use each? ♦️

Does the new Layout protocol animate between VStack and HStack? ♦️ ⭐️ 💬 ⚠️

How does ViewThatFits decide if a view fits? ♦️ ⭐️

How can i get something similar to autolayout priorities? ♦️ ⭐️

Alignment guides and the new Layout protocol ♦️

What happens to a subview if you don’t call .place() on it in placeSubviews in a Layout? What happens if you call it twice? ♦️ ⭐️

When is Layout calculated? ♦️

Does Layout support lazy-loading its subviews? Would it be a good replacement for UICollectionView with a custom layout? ♦️

Can I use custom layout to create a hierarchical tree map/view of rectangular boxes of data items connected with lines?

Do LayoutValueKey values travel up through nested Layouts? Also, how are they different from PreferenceKey? ♦️ ⭐️

Do all system stacks implement the Layout protocol for use in AnyLayout? Is this documented anywhere? ♦️ 💬 ⚠️

How does Layout interact with other view modifiers or constructs that can provide layout data? ♦️ ⭐️

Should Layout work fine with UIKit-representable views? ♦️ ⭐️

Is it possible to use @State, et. al from within a custom Layout? ♦️ ⭐️

Is it possible to compose some HStack and VStack within my custom Layout? ♦️ ⭐️

Previews

Tip: Xcode Previews and Tabs ♦️ 💡

Tip: New Previews experience with the previewLayout modifier ♦️ 💡

Any tips to make Previews run faster? ⭐️

What’s the best practice for working with Core Data and SwiftUI previews, such that we don’t end up interacting with the actual store data? ⭐️

Is there a fix for Previews failing with views in SPM modules? ⭐️

How do I see multiple previews at the same time with Xcode 14? ♦️

Is it possible to print to the console while in SwiftUI previews?

Sharing

Transferable: Can we create our own custom payload for internal app drag and drop? ♦️

Tip: PhotosPicker and ShareLink on watchOS 💡 ♦️

Can you print / create a PDF on watchOS? or from tvOS with ShareLink? ♦️

Does Transferable support async behavior like NSFilePromiseProvider? ♦️ ⭐️

SwiftUI + UIFrameworks

What would be the recommended way to update cell’s height when used with DiffableDataSource? ♦️ ⭐️

Is there a way to coordinate between SwiftUI DragGesture with their UIKit counterparts?

In SwiftUI, is there a way to listen for navigation events or would that have to be custom from UIKit delegates?

Is there an analog to AppKit’s flagsChanged notification? ⭐️

Windows, Scenes, Sheets, Popovers and MenuBarExtra

Are windows available for iOS and iPadOS or only macOS? ♦️ ⭐️

Using the new Window scene for splash screens ♦️

Creating an onboarding experience with SwiftUI ♦️

Can a presented view switch between popover and sheet style, depending on size class?

Is it possible to control a MenuBarExtra window width and height? ♦️ ⭐️

Is it possible to create a windowless app with MenuBarExtra? ♦️ ⭐️

How to make MenuBarExtra persistent after app quits? ♦️

Other Questions

Any updates related to UI testing in SwiftUI apps? ⭐️

Is it possible to reorder items and insert into an outline group?

When is onAppear/onDisappear called? How do they compare to the UIKit equivalents of did/willAppear? ⭐️

Difference between ViewModifier and custom Views

When using .contextMenu on a List , how can I find out what was actually selected? ♦️

Is there a value of avg. duration that no View’s body should go above for avoiding performance issues?

Are there any tools to help implement good design? (e.g., Sketch export tools to generate code for components/symbols)

Can onTapGesture be used more than once on a single view? Like single-click to select, double-click to open in a window?

Tip: Modifying the background of a SwiftUI List ⭐️ ♦️ 💡 💬 ⚠️


Summary

Congratulations for reaching the end of this long post. I hope you enjoyed the SwiftUI Digital Lounge content.

Please feel free to comment below, and follow me on twitter if you would like to be notified when new articles come out. Until next time!

2 thoughts on “WWDC 2022: Lessons from the SwiftUI Digital Lounges”

  1. Thanks so much for capturing and sharing this! I’ve learned more about SwiftUI from this site and SwiftUI Companion than everywhere else combined 🙂

    Reply

Leave a Comment

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close