Notes WWDC 2022 : What’s new in UIKit
Mes notes pour la session What’s new in UIKit de la WWDC 2022.
Productivity improvements
Improved navigation bars
- 2 new navigation styles (
browser
andeditor
) - Customisable items
- Title menu
- Optimised with Catalyst
Find and replace
- Need opt-in
- For
UITextView
,WKWebView
,PDFView
Edit menu
- Customisable
- New
UIEditMenuInteraction
API
Materials in Sidebar
On by default in overlay sidebar mode
Control enhancements
- New
UICalendarView
, represents dates asDateComponent
UIPageControl
improvements- Pasteboard access displays alert the first time, new
UIPasteControl
API refinements
- Custom detents to show sheets of any size
- SFSymbol
- New inherent rendering mode (can be not monochrome by default)
- Variable symbols
UIImage(systemName:, variableValue:, configuration)
- Swift concurrency, Sendable:
UIImage
,UIColor
,UIFont
,UITraitCollection
- State Manager: no code required, deprecate
UIScreen.main
,UIScreen
lifecycle notifications - Self-resizing cells for
UICollectionView
andUITableView
by default:selfSizingInvalidation
- Automatic when using
UIListContentConfiguration
- Manually with
invalidateIntrinsicContentSize()
- With Auto Layout, can use
.enabledIncludingConstraints
- Automatic when using
UIKit and SwiftUI
Build cells with SwiftUI:
cell.contentConfiguration = UIHostingConfiguration {
VStack {
Image(systemName: "wand.and.stars")
. font(.title)
Text("Like magic!")
.font(.title2).bold()
}
.foregroundStyle(Color.purple)
}
UIDevice.name
reports model name (to avoid fingerprinting)UIDevice.orientation
not supported- Use
PreferredInterfaceOrientation
instead
- Use