Apple’s WidgetKit update lets developers build for the Lock Screen and Watch with the same code

2 years ago 135

At a developer briefing following Apple’s keynote address at its Worldwide Developer Conference this afternoon, the company went into more detail about the different types of widgets developers can now build for the iOS 16 Lock Screen. Inspired by the Apple Watch’s complications, Apple said these new widgets can help developers leverage key information from their app and display it where people can view it at a glance. Notably, all these Lock Screen widgets will work on both iOS and watchOS because, starting with watchOS 9, complications will also be powered by WidgetKit.

That means, for the first time, developers will be able to use the same code to generate glanceable information on both platforms, where the differences between platforms are handled automatically, Apple noted. That is, the widgets will be created using the appropriate system fonts by default, and the Lock Screen widgets will be tinted for maximum legibility.

At launch, developers will be able to choose from three different widget designs: circular, rectangular, and inline.

The circular widgets are ideal for displaying a small image, page, or a few characters of text. These widgets would be great for doing something like letting the user know with a glance how active they’ve been today or if it’s time to go for a run, similar to Apple’s activity rings. Another widget design, rectangular, provides a larger canvas. This could be better for displaying something like an upcoming weather forecast, Apple explained.

The inline widget, meanwhile, provides a way to convey information with a tiny amount of text and SF Symbols — Apple’s library of iconography that today includes over 4,000 different symbols. These inline widgets would display above the Lock Screen’s clock and next to a system-supplied date string, such as “Mon 6” (for “Monday the 6th). In an example published alongside an upcoming WWDC 2022 session, Apple showed how this widget could provide the weather above the clock. Here, the date is followed by a sun symbol for the weather, as well as the current city.

All the widgets will be designed by developers using WidgetKit, which is the toolkit that’s already being used to build home screen widgets for iOS, iPadOS, and macOS. With the WidgetKit update rolling out later this year, developers will also be able to build these new widgets as well as complications in watchOS. This could greatly expand the capabilities of home screen personalization apps like Brass, Widgetsmith, and others, which could provide a set of matching widgets for the Home Screen, Lock Screen, and Watch, allowing users to customize all their devices in the same way.

Another new feature will give widgets the power to show real-time information. Developers will be able to create Live Activities, which are built with Swift UI, in order to provide the most current information to the Lock Screen. Like widgets, these Live Activities are also built with WidgetKit. The difference between a standard widget and a Live Activity is that developers will update the latter’s presentation and state in real-time so the most up-to-date is shown when the user looks at the widget. In reality, Live Activities are basically just real-time widgets of sorts, but Apple has given it a different name.

The updates to WidgetKit will roll out with iOS 16 later this year.

Read more about WWDC 2022 on TechCrunch

Read Entire Article