IFang Lee2 min

Swiftly Highlights: iOS 16 Beta

EngineeringAug 4, 2022

The second iOS 16 and iPadOS 16 beta updates are now available on the Public Beta website for public beta testers. iOS and iPad 16 Beta 4 has been seeded to engineers with some new features and changes — more on that in the release notes.

Let’s get straight to exploring the incredible new features in iOS 16.

SwiftUI

Before SwiftUI 4, you had to do some hacks with UIActivityController and UIViewRepresentable for share sheets since there was no native way to implement it. ShareLink, which is introduced in SwiftUI 4, is a view that takes care of the sharing sheet interface. Simon Ng gives us straightforward code examples to share data of framework types like URL, Image and String.

What's more, ShareLink can share any content that conforms to Transferable and provides a preview containing a caption and icon that appear immediately, without fetching the sharing link's metadata over the network.

ImageRenderer is another new API for SwiftUI 4, which creates images from any SwiftUI views. The implementation is quickly done. You can also access the  CGImage, NSImage, or UIImage by using its properties. ImageRenderer not only renders images but a PDF document with scalable and searchable graphics. You could make the PDF file available to the Files app by changing ‘UIFileSharingEnabled’ and ‘LSSupportsOpeningDocumentsInPlace’ settings in ‘Info.plist’.

Want to dig deeper into what's new with SwiftUI in iOS 16? Natalia Panferova joined John Sundell on his podcast to share her experience with working on the SwiftUI framework at Apple and to talk about the latest updates to SwiftUI 4 — including new SwiftUI navigation APIs, which allow engineers to define stack-based navigation and multicolumn navigation.

With a new modifier called presentationDetents, resizable bottom sheet APIs make the bottom sheet natively supported. And something to make note of is Swift Chart, a robust framework for constructing and customizing charts on every Apple platform — take a look at some sample codes for building a bar chart.

Although there are still limitations in SwiftUI 4 (which will hopefully be covered soon), you can hack them by adding a UIKit view to SwiftUI projects and vice versa.

UICalendarView

I believe many engineers have experience building a calendar view with UICollectionView. UICalendarView displays a calendar with date-specific decorations and provides a single date or multiple dates selection, compared to UIDatePicker only supporting a single date selection. Along with UICalendarView, engineers might be happy to save time when creating a custom calendar view.

ActivityKit

Live Activities and ActivityKit display and update an app's most current data on the Lock Screen — used, for example, with a live sports game or food delivery status. It lets users take a look at the live information they most care about. Check the Live Activities example for Pizza Delivery with SwiftUI and WidgetKit.

RoomPlan

RoomPlan API is powered by ARKit that uses the camera and LiDAR scanner to create a 3D floor plan of a room and collect data about a room and its contents, such as room features and furniture. You definitely shouldn't miss the fantastic demo on WWDC 2022 and the video of the proof of concept App developed by Shopify. Or go and get your hands dirty by creating a 3D model of an interior room by guiding the user through an AR experience.

That's it for July! Hope you like those cool new features, and see you next month!

Share this article


What to see next...


Sign up to our newsletter

Monthly updates, real stuff, our views. No BS.