- Date: [[June 8th, 2021]] - Conference: [[WWDC 2021]] - Speaker(s): - Video:https://developer.apple.com/videos/play/wwdc2021/10018/ - Slides: - Tags: [[Talks]] - History - Release 1 - Declaritive UI - Release 2 - 100% SwiftUI apps - Release 3 - Deeper adoption - Better lists - `AsyncImage` - Placeholder - Can be customized - Modify the loaded image - Animations - Error handling - `refreshable` Modifier - Configures a refresh action and passes it down through the environiment - List implements [[Pull to Refresh]] - Can also be used to build custom ones - `task` Modifier - Runs as soon as the load is first loaded - Load the first batch of photos automatically - `AsyncSequence` - See: [[Discover concurrency in SwiftUI]] - Beyond lists - Passing bindings into List and Text - [[Interactive Collections]] - `List($directions)` - Back deploy to any release supported by Swift UI - `listRowSeparationTint` - `listRowSeparator(.hidden)` - Swipe Actions - `.swipeActions` - `.tint` for color - Change to leading using `edge:` - Works on all platforms that support swipe actions - Multicolumn `Table` on `macOS` - Interactive - `TableColumn` - Sortable via `KeyPath` - Multiple visual styles - `@FetchRequest` now supports bindings to sort descriptions and sectioned fetch requests via `@SectionedFetchRequest` [[Core Data]] - [[Search]] - `searchable` Modifier - Automatically adds a search field to the right spot and optional shows suggestions - Provides a binding for search text - [[Drag & Drop]] - Now supports custom previews - Importing data - `importsItemProviders` Modifier - `ImportFromDevicesCommands` on Mac - Exporting data - .exportsItemProviders` modifier to expose data to the rest of the system - Shows up in the [[Services Menu]] in [[macOS]] - Advanced graphics - `SFSymols` - New rendering modes - Monochrome - Multicolor - Hierarchical - Plaette - Custom colors for different layers - Don’t overspecify variants - SwiftUI automatically picks for you now. - `Canvas` - `accessibilityChildren` - `TimelineView` - Screensaver type view - Always on watchOS Display - `TimelineView` can preload your apps views for this mode - `TimelineSchedule.everyMinute` - Or use Explicit dates, animations, periodic - `privacySensitive` modifier automatically redacts when watch is in private state - Can also be used for widgets when devices are locked - [[Materials]] - `.background(.ultraThinMaterial)` - Can give any shape - Use `.foregroundStyle` to get automatic vibrancy - `safeAreaInset` mofier - See: [[[[WWDC 2021]]: Add rich graphics to your app in SwiftUI]] - Better [[Accessibility]] support in the [[Inspector]] - Text and keyboard - [[Markdown]] support in `Text` - Type safe attributes in AttributedSting - Automatic Grammar Agreement - Markdown localization - Use Compiler to Extract Swift String - See: [[[[WWDC 2021]]: Localize your SwiftUI app]] - You can now restrict the range of type sizes - `.textSelection(.enabled)` - Can be applied to any view - `Text(date.formatted())` - Text formatting for lists as well - `.onSubmit` Modifier for fields and forms - `.submitLabel` (used for the return key) - `.keyboard` toolbar placement - Touch Bar or Input Accessory View - `@FocusState` - Binding to what’s focused - Can be any Hashable value - Dismiss the keyboard by setting it to nil - More buttons - Standard Bordered buttons on iOS - `buttonStyle(.bordered) - Supports tinting - `.controlSize` - `.controlProminence` - `keyboardShortcut(.defaultAction)` - All of these support dark mode, dynamic type - Semantic desctructive buttons - Confirmation Dialogs - `.menuIndicator(hidden)` - `Menu` can now have primary action - ControlGroup - A little tighter in iOS to group them