title: [[[[WWDC]] 2020]]: What’s New In SwiftUI --- title: [[[[WWDC]] 2020]]: What’s New In SwiftUI --- - **Metadata**: - Date: [[June 23rd, 2020]] - Conference: [[WWDC 2020]] - Speaker(s): Matt Ricketson and [[Taylor Kelly]] - Video: https://developer.apple.com/videos/play/wwdc2020/10041 - Slides: - Tags: [[Talks]] - Apps and Widgets - Apps - `[[App]]` - Designed to follow declarative, state driven patterns - `body` property - Returns a `Scene` - See [[[[WWDC 2020]]: App Essentials in SwiftUI]] - `[[WindowGroup]]` - Intelligent multi-platform functionality - Can run on iOS, watchOS, tvOS and will look different - Multi Window Apps for free on iPadOS and macOS - `[[Settings]]` scene on macOS - Automatically sets up preferences window and styling - `[[DocumentGroup]]` scene - Opening, editing and saving Document-based scense - Automatically presents a document browser - Adds Save, duplicate, etc - `.commands` Modifier - Automatic menu items - `keyboardShortcut` modifier - See: [[[[[[WWDC]] 2020]]: App Essentials in SwiftUI]] and [[[[[[WWDC]] 2020]]: Document Based Apps in SwiftUI]] - New Mutliplatform Templates in Xcode - [[Launch Screen]] Info plist Key - Default Images - Background Colors - Empty Top and Bottom Bars - "no reason to switch" - Widgets - See: [[[[[[WWDC]] 2020]]: Build SwiftUI Views for Widgets]] - [[watchOS]] Complications - Full Color - See: [[[[WWDC 2020]]: Build Complications in SwiftUI]] and [[[[WWDC 2020]]: Creating Complications for Apple Watch]] - Lists and Collections - Outlines - `List.children` key path for outlines - Grids - Lazy loading grid layout - Composable with scroll views - Adaptive number of colums - Or forcing a fixed number of columns - Horizontally scrolling grids - Lazy versions of `[[VStack]]` and `[[HStack]]` - View Builder support for `switch` - Toolbars and Controls - New look in [[Big Sur]] - New experience in [[iPad]] - Added to [[watchOS]] - `.toolbar` modifier - Use `Button` inside them - Use `ToolbarItem` to customize placement - `Label("Progress, systemImage: ""book.circle")` - See [[[[WWDC 2020]]: SFSymbols 2.0]] - `Label` is great for Dynamic Type and Accessibility - `.help` Modifier - Tooltips on [[macOS]] - Provides and [[Accessibility]] hint - `keyboardShortcut` - Most often used for `Scene` comamnds - Can also be used for other buttons on screen - Focus - Default Focus location - See [[[[WWDC 2020]]: SwiftUI for tvOS]] - `[[ProgressView]]` - Indeterminiate - Circular - `[[Gauge]]` - value, current, minimum, maxium - Used on watchOS a lot - [[Swift]] - Multiple trailing closure syntax - Effects and Styling - `matchedGeometryEffect` - Seamless frame interpolation - `ContainerRelativeShape` - Takes on the corner radius relative to the shape of the widget - `padding` - `Image`s ccan be part of `Text` - See: [[[[WWDC 2020]]: The Details of UI Typography]] - Accent Color - Customizable on macOS - Asset Catalog Customization of Accent Color - `listItemTint` - Per item or per section - `toggleStyle` - `SwitchToggleStyle` - System Integratoin - `Link` view to open URLs - Opens in the default web browser - Can also open universal links - Links also work within widgets - `openURL` action in the environment - Drag and Drop - New UTI Framework - `SignInWithAppleButton` - Lots of other frameworks now offering SwiftUI views - Swift - Syntax refinements - Diagnostics - Performance improvements