title: [[WWDC 2020]]: Build with iOS Pickers, Menus and Actions --- title: [[WWDC 2020]]: Build with iOS Pickers, Menus and Actions --- - **Metadata**: - Date: [[June 24th, 2020]] - Conference: [[WWDC 2020]] - Speaker(s): - [[Erik Dudiak]] - [[David Duncan]] - Video: https://developer.apple.com/videos/play/wwdc2020/10052/ - Slides: - Tags: [[Talks]] - `[[UISlider]]` and `[[UIProgressView]]` - Updated thickness - Consistency across platforms - Full Mac control on [[Catalyst]] app - Some customization is unused - See [[Optimize the Interface of Your Mac Catalytst App]] - `[[UIActivityIndicatorView]]` - New, simpler design - Use color API and modern styles - Also updates "pull-to-refresh" `[[UIRefreshControl]]` - `[[UIPickerView]]` - Updated styling - Consider menus where approprite - `[[UIPageControl]]` - New interactions - Unlimited pages - Enhanced customization APIs - Optional custom indicators - Multiple stlyes - Example - `numberOfPages = 5` - `backgroundStyle = .prominent` - `preferredIndicatorImge =` - `.setIndicatorImage , forPage:` - `[[UIColorPickerViewController]]` - New View controller for picking colors - Presents as sheet or popover - Select a color - Eyedropper - Favorites - Hexademical specification - Example - `supportsAlpha` - `selectedColor` - Delegate for selection and cancellation - `[[UIDatePicker]]` - Compact Style on iOS - Useful with Space constraints - Full modal calendar when selecting date - Keyboard for selecting tyime - Optionally limit to just date or time - New macOS stlye - Compact, modal calendar presentation - Supported in all Catalyst apps - Optionally limit to just date and time - Inline Style - Great for iPad or Primary UI - Matches Modal Presentation - Optionally limit to just date and time - Settable properties - `preferredDatePickerStyle` - `calendar` / `locale` - Menus - `[[UIButton]]` and `[[UIBarButtonItem]]` support - Assign a menu to either - UIKit will display on long press - In some cases you don’t want to wait - `showsMenuAsPrimaryAction = true` - For `UIBarButtonItem`, providing a `menu` with no `action will show the menu on tap. - Menus in `[[UINavigationBar]]` - Choses best title from - `backBarButton.title` - `backButtonTitle` - Menus in controls - `showsMenuAsPrimaryAction` - `contenxtMenuInteraction` - `menuActionTriggered` - `[[UIDeferredMenuElement]]` - Asynchronously provided menu items - Useful for generating complex menus - `[[UIContextMenuInteraction]]` - `updateVisibleMenu` - Modify or replace provided menu - Display automatically adjusts - `[[UIContextMenuInteraction]]` - `menuAppearance` - Rich - `[[UIAction]]` - `[[UIBarButtonItem]]` - `[[UIButton]]` - Can now support closures via `UIAction` - `[[UISegmentedControl]]` - Can be created with `UIAction` as well - `init(frame:actions:)` - Per segment action handling - Guidance - Refresh your UI - Adopt `UIColorPickerViewController` - Accelerate interactions with menus - Support rapid navigation with new back button menus - Simplify and share code with `UIAction`