WWDC Wednesday: pickers, menus, and actions, oh my!

Aaron Brethorst, June 25, 2020

Image: © 2013 Aaron Brethorst

Today ended up being unexpectedly busy, and I ended up watching just a single WWDC session. But, it was a great one, and I'm excited to share a bit about it with you. I watched Build with iOS pickers, menus and actions, which offers details about some of the really exciting changes Apple is making to a number of core UIKit controls in iOS 14.

Specifically, this session covers appearance changes to some UIKit controls in iOS 14, and also introduces UIColorPickerViewController— jump to about 5:30 in the session to see this new component. UIDatePicker has also received some much-needed love, which you can learn more about by jumping to 7:30 in this session.

After that, the session drills down into a small but mighty new feature coming in iOS 14: you can attach a menu to UIButtons and UIBarButtonItems.

Add menus to UIButtons and UIBarButtonItems by assigning a UIMenu object to those controls' menu property. By default, menus will appear after a long press on the button. You can also immediately show a menu by setting the UIButton property showsMenuAsPrimaryAction to true, or by not setting a primary action on UIBarButtonItem.

I've created a repository on GitHub with some sample code demonstrating this feature. Check it out!