From the blog

WWDC “What’s new in UIKit”

Hi, I’m Vera, an iOS and Android developer at Rightpoint. I hope you enjoyed WWDC! If you’re anything like me, it was like drinking from a fire hose. I really enjoy working on the UI elements of an app, so I prioritized watching the UI videos, and thought I’d share some of my thoughts on “What’s new in UIKit”. 

 iPad productivity and multitasking. One of the first things they talked about was productivity on the iPad and the new multitasking abilities, including the new window shelf that allows you to quickly switch between windows on the iPad. Honestly, this didn’t excite me much, but people who work more with iPads may have a different reaction. 

Code for opening in new window on iPad
iPad: Open in new window (Apple)

Improved pointer controls. Accessories were added, which look like symbols around the pointer. The video was unclear to me how this worked. As far as I could tell there were some dots, then there were some triangles around the dots. While I didn’t see the immediate applications, I’m looking forward to finding out how the community uses this new feature. 

Band-selection. This refers to clicking or tapping outside and across several items to select. It’s new to iOS and implemented by default in collections that support multiselect. This is a small, but very cool thing to have added. It’s a nicely intuitive way of selecting multiple items. I bet a lot of people are happy to see this feature.

Shortcuts on iPad revamped. The way to declare shortcuts was changed. Anywhere you use UIResponder.keyCommands will need to be folded into the UIMenuBuilder and used with the buildMenu function in AppDelegate.  

New keyboard shortcuts definition on iPad
Keyboard Shortcuts (Apple)

Focus. The way focus is determined between items and groups is now built on the same groundwork as tvOS and CarPlay. This seems like more of a behind-the-scenes change but will hopefully mean better support for focus everywhere. We can’t compare it to an alternate timeline where focus remains fragmented between operating systems, but the change sounds like a good thing. 

Drag and Drop on iPhone. Just what it sounds like! You can drag photos between apps for example. APIs did not change. Sounds great in theory, might not have widespread adoption, but it’s nice that users will have this option. 

UITabBar/UIToolBar appearance change. New defaults. To keep your apps behaving properly you’ll have to take out all the futzing around you did to make it look nice, because all the customization won’t play nice with the new appearances. Specifically, manually changing translucency to false and setting a non-default edgesForExtendedLayout will cause visual bugs. I’m somewhat hopeful that the new defaults will look good on most apps, but I’m not looking forward to making these changes. However, you can set custom appearances using UITabBarAppearance. The edgesForExtendedLayout is replaced by the function setContentScrollView which sets which scrollView is activated on which edge. Some cool interactions can probably be built with that. 

New UITabBar appearance and UIViewController scrolling
Updating UITabBar appearance and viewController scrolling (Apple)

TableView Styles. Default Plain style got a little prettier, and two additional prominent and extraProminent styles have been added. You can also change separator styles (since 14.5) . I couldn’t tell from the video what distinguished the new styles. It appeared to be a black background instead of light-colored, and I couldn’t tell the difference between prominent and extraProminent. 

Half-height sheets. Now that’s what I’m talking about! I’ve made so many half-height sheets using a variety of approaches, so it will make things much easier to have a native method to create them. In addition, the sheets can be modal or non-modal. In modal form, it blocks interaction with the rest of the screen, but in non-modal form you can interact with both the background and the sheet. Also, the sheets look easy to pop between half and full sheet as needed. 

New Button Styles. Formerly the default was a plain button that looked like a link, and you had to define those pretty pill-shaped buttons. Now there are additional button styles, which include gray, tinted (which are partially-see-through), and filled, which make the lovely buttons you always wanted. Multiple lines are now supported too. To access these buttons, use the new UIButton.Configuration. Who says Apple never did anything for you? 

New button styles
New button styles (Apple)

Collapsible Submenus. The API is the same for submenus, they just look nicer now. I always love passive enhancements. 

SF Symbols. These are either newly available in UIKit or there are more of them. There are new ways of coloring them and for variants. The projects I’ve worked on haven’t been able to use these icons due to cross-platform design constraints, but for people programming iOS-only this could be useful. 

Dynamic type size limitation. This allows you to declare a range of acceptable sizes for dynamic type to use. It’s useful for limiting the range of sizes of layout you support. However, it is best used sparingly, to allow users the flexibility to use type that meets their visual needs. This could be a good thing if used well, but I’m wary of a feature that Apple must warn developers against using inappropriately. 

Color improvements. UIColor has been unified across platforms, leading to small changes on each platform. Most of our projects need to match brand colors rather than use name-specified colors, however people without those constraints can now match visuals cross-platform. TintColor is dynamic, but they weren’t clear on what that means. 

TextKit2. This is an improved text layout handler. It is entirely behind the scenes and will improve the layout of text, particularly in complex languages. It will be working on your iOS 15 devices. Hooray passive improvements! 

UIScene state restoration. Enhancements were made. The point was made that if you’re not using the UIScene API (available as of iOS 13) instead of the `UIApplication` based API, you really should be migrating as soon as possible. I am not looking forward to that migration. For backward compatibility many of my projects are still targeting iOS 12, but in a few months that likely will be changing. 

Cells in UICollectionView and UITableView. Great news here. You no longer need to subclass UICollectionViewCell and UITableViewCell and override a bunch of methods. Instead, there is a new property of the cell called configurationUpdateHandler which can be assigned a closure to determine how the cell updates. This looks like a welcome new development and I’m looking forward to trying it out. 

New UICollectionViewCell configurationUpdateHandler
New UICollectionViewCell configurationUpdateHandler (Apple)

Collection and Table Performance updates. Performance updates are always welcome. Cell prefetching is improved behind the scenes, new functions using the new async/await paradigm allow better image preparation and thumbnail creation performance. I’m looking forward to seeing the performance of these new functions, and it looks like these interfaces are easy to read and write once you get used to the async/await paradigm. 

New image thumbnailing preparation
Image thumbnail preparation (Apple)

More async/await. Moving into the async/await paradigm all UIKit functions have been either tagged MainActor (making them run on the UI thread) or otherwise tweaked to work with async/await. This allows the compiler to help make sure you’re using the functions properly. And I think more compiler help is a good thing! 

Location Button. You can add a button to your app that, when tapped, shares the current device location with your app. This is convenient for when you would like a user’s location, but don’t need it all the time. The user is explicitly giving the location at that specific time, and you don’t need to have all the notification popup. I can definitely see using this in the future. 

Paste upgrades. iOS 14 introduced a paste banner that would let you know when something was getting pasted. In iOS 15 the banner is eliminated when there is obvious user interaction. I don’t have strong feelings about this, but I guess people found it annoying. There is a new API for additional paste options, now including paste & go, paste & search and paste & match style. This seems nice and convenient. Finally, PasteboardDataDetectors allow your app to see what type of data is on the clipboard (number, URL, flight number), without needing access to the data itself. I haven’t run across a situation that would need this, but it’s a nice option to have. 

Privacy-preserving click measurements. Use a UIEventAttributionView to cover the ad (or whatever) that needs click measurement. This is a more complex topic deserving more discussion, but it sounds very useful for user acquisition and other analytics. 

Whew! That was a lot, some was small, some was large, some was exciting some less so. My favorite announcements in this video are the new API for UITableViewCells, half-height sheets, and the new button options. I’m also quite excited to be incorporating the new asynchronous paradigm. Items I think we need to pay attention to, although I’m not excited for the related refactors, are the UITabBar changes and using UIScene. For more details, view the video yourself at https://developer.apple.com/videos/play/wwdc2021/10059/.

Happy Programming! 

Leave a Reply

Your email address will not be published. Required fields are marked *