Last updated 5 min read

What's new in UIKit – WWDC2022

New Navigation Bar features, new UICalendarView, and UIPageControl. Pasteboard access permissions. UISheetpresentationController improvements. SFSymbols rendering modes. Self-resizing cells. UIHostingConfiguration to embed SwiftUI into UICollectionView and UITableView. Here is a detailed summary.
#iOS App Development

Productivity

Improved nav bars

Now there are 3 navigation styles for navigation bars:

  • Navigator
  • Browser
  • Editor

Browser style can be used for apps that support some kind of "history" or side folder structure for navigation, like web or document browsers. Editior is cool for editing workflows: documents, images, etc.

/content/images/2022/06/Screenshot-2022-06-21-at-19.25.16.png

Editor navigation style now supports configurable items in the middle. Supports drag-in-drop with items customization pop-up.

/content/images/2022/06/Screenshot-2022-06-26-at-14.00.47.png

To fit the screen size, items are automatically moved to a side menu in side-by-side mode:

/content/images/2022/06/Screenshot-2022-06-21-at-19.27.50.png

Title Menu

For new navigation styles there is a new title menu, allowing to handle common actions like duplicate, move, rename export, print, etc.

/content/images/2022/06/Screenshot-2022-06-21-at-19.28.21.png

When the app is built with Mac Catalyst, the title menu and central items are automatically wrapped into NSToolBar:

/content/images/2022/06/Screenshot-2022-06-21-at-19.29.04.png

Find and Replace

Gods of UX decided to add in iOS16 find and replace functionality for UITextView, WKWebView, and PDFView. It only requires a single flag to be set and here we go.

/content/images/2022/06/Screenshot-2022-06-21-at-19.33.41.png

Editing Interactions

Editing interactions got an amazing update in iOS16. UIMenuContoller got deprecated in favor of the brand new UIEditMenuInteraction API.

Now, editing interactions look different, depending on the input method.

Familiar copy/select/paste menu on tap:

/content/images/2022/06/Screenshot-2022-06-21-at-19.35.38.png

Or full-featured context menu when using a pointer:

/content/images/2022/06/Screenshot-2022-06-21-at-19.36.57.png

UIEditMenuInteraction works well in pair with Mac Catalyst to encourage a desktop level of convenience.

Recommended to watch:

  • [[Adopt desktop class editing interactions - WWDC2022]]

Materials in Sidebar

The sidebar in a slide-over mode now automatically becomes vibrant.

/content/images/2022/06/Screenshot-2022-06-26-at-14.23.27.png

Recommended to watch:

  • [[Meet desktop class iPad - WWDC2022]]
  • [[Build a desktop class iPad app - WWDC2022]]

Controls Enhancements

UICalendarView

UICalendarView is introduced as a powerful alternative for picking dates with a date picker.

/content/images/2022/06/Screenshot-2022-06-26-at-14.31.25.png

The main difference is that UICalendarView uses UIDateComponents as date representation instead of the plain Date used in UIDatePicker. it requires explicitly providing the calendar that is used for UIDateComponents and allows to be more specific when handling dates.

UICalendarView also supports multi-select and custom decorations.

/content/images/2022/06/Screenshot-2022-06-21-at-19.46.51.png

UIPageControl

UIPageControl API got an update allowing to customize current page indicator images depending on the selection state.

Now it UIPageControl to customize layout directions:

/content/images/2022/06/Screenshot-2022-06-26-at-14.50.34.png

Pasteboard Access

In iOS15 a notification was shown up every time when app accessed pasteboard programmatically:

/content/images/2022/06/Screenshot-2022-06-21-at-20.26.08.png

In iOS16 on pasteboard access it shows permission alert instead:

/content/images/2022/06/Screenshot-2022-06-21-at-20.26.13.png

There is a way to avoid permission alerts. It's by using the new UIPasteControl:

/content/images/2022/06/Screenshot-2022-06-21-at-20.27.28.png

API Refinements

UISheetpresentationController detents customization

Since iOS16 UISheetpresentationController allows to provide a list of detents, including custom ones with absolute:

/content/images/2022/06/Screenshot-2022-06-21-at-20.31.04.png

or percentage size:

/content/images/2022/06/Screenshot-2022-06-21-at-20.31.17.png

Detent identifier was introduced allowing to set different customization options for specific detent ids:

/content/images/2022/06/Screenshot-2022-06-21-at-20.31.25.png

As noted, the value returned from the custom detent block should not account for bottom safe areas inset. It allows using the same calculation both for floating and edge attached sheets.

/content/images/2022/06/Screenshot-2022-06-21-at-20.35.54.png

Recommended to watch:

  • [[Customize and resize sheets in UIKit - WWDC2021]]

Symbols Rendering

iOS allows rendering symbols in different modes: monochrome, multicolor, hierarchical, and palette.

/content/images/2022/06/Screenshot-2022-06-21-at-20.39.44.png

The default rendering mode used to be monochrome, but since iOS16 it is not the default anymore. Not it's hierarchical. But it can be turned back to monochrome by preferred symbol config:

/content/images/2022/06/Screenshot-2022-06-21-at-20.40.45.png

Now symbols support variable rendering values:

/content/images/2022/06/Screenshot-2022-06-21-at-20.43.36.png

Recommended to watch:

  • [[Adopt variable color is SF symbols - WWDC2022]]
  • [[What's new is SF Symbols 4 - WWDC2022]]

Swift Concurrency and Sendable

For thread-safety purposes these guys are now sendable and can be used within actors:

  • UIImage
  • UIColor
  • UIFont
  • UITraitCollection
/content/images/2022/06/Screenshot-2022-06-21-at-20.47.40.png

by contrast, this guy is still not:

/content/images/2022/06/Screenshot-2022-06-21-at-20.47.58.png

Recommended to watch:

  • [[Eleminate data races using swift concurrency - WWDC2022]]
  • [[Visualize and optimize swift concurrency - WWDC2022]]

Stage Manager

Apple encourages us to adopt multi-windows support in our apps with the introduction of the stage manager.

A few things are going to be deprecated:

  • UIScreen.main
  • UIScreen lyfecycle notifification
/content/images/2022/06/Screenshot-2022-06-21-at-20.51.48.png

Instead, Apple suggests using more specific APIs like trait collections and UISceene APIs.

Self-sizing Cells

Self-sizing cells are kicking iOS developers' asses for years. I remember the times when they were first introduced on iOS8. I also remember how much extra effort the required on iOS6 and iOS7.

Today we are fortunate to be eyewitnesses of self-sizing cells becoming the default behavior. I'm happy that Apple never leaves iOS devs without work by introducing new improvements for cell self-sizing.

/content/images/2022/06/Screenshot-2022-06-21-at-20.53.54.png

Cells layout lifecycle now allows to manually invalidate sizes by invalidateIntrisicContentSize()

/content/images/2022/06/Screenshot-2022-06-21-at-20.54.44.png

or we can rely on autolayout that will automatically tell the cell when its size needs to be invalidated.

/content/images/2022/06/Screenshot-2022-06-21-at-20.57.25.png

UIKit and SwiftUI

The huge interoperability improvement is UIHostingConfiguration for embedding SwiftUI views in UIKit cells:

/content/images/2022/06/Screenshot-2022-06-21-at-20.59.58.png

Recommended to watch:

UIDevice deprecations

For privacy reasons, UIDevice.name no longer returns the device name assigned by the user. Since iOS16 UIDevice.name will only return the name of the model, that will lower the chance of users being fingerprinted.

/content/images/2022/06/Screenshot-2022-06-21-at-21.02.01.png

References

What's new in UIKit - WWDC2022