Apple Swift

Apple overhauls SwiftUI navigation and brings a score of new features to developers at WWDC 2022

Xcode also receives performance improvements and additional functionality, while Xcode Cloud is finally launched too
Pro
Image: Apple

7 June 2022

Apple’s developers have been treated to an abundance of new features during its annual Worldwide Developer Conference (WWDC), with Swift, SwiftUI, and the Xcode integrated developer environment (IDE) all receiving additional functionality.

Among the standout features coming to the SwiftUI framework is the new Navigation API which brings with it NavigationStack (beta), succeeding the now-deprecated NavigationView.

The new navigation controller has been greeted warmly by the developer community and provides support for quick deep linking. One drawback is that developers will have to juggle the two types of navigation controllers since the new API is only available to use on the new iOS 16 version.

 

advertisement



 

Businesses running devices that can’t run iOS 16 and beyond will have to choose a single compatible navigation method before the older devices can be replaced.

Another feature that has generated much fanfare is the ability to create charts using code. Swift Charts uses a declarative syntax to bring developers the ability to create different types of charts with many degrees of customisation.

It has typically been difficult to create charts using Swift and the process was previously a highly manual one, with users forced to use the GeometeryView container view and Path type, for example.

The new Layout protocol is another of the standout new features – it will allow developers to create highly customisable two-dimensional layouts. If one of the pre-built layouts does not work for a developer’s app design, they can make one that does.

The new protocol also allows developers to build bespoke containers with custom behaviours, as well as create animated transitions between layout types.

Other layout-related changes include the introduction of the Grid API which allows developers to align views horizontally and vertically, and place views in a simple grid.

The new ViewThatFits type will also bring new layout functionality to developers’ projects, allowing them to place the first or second child views depending on which one fits the defined axes the best.

There are also new developer kits to use like WeatherKit, a reboot of the Darky Sky API Apple acquired two years ago. It will allow developers to tap into the same functionality and data used by Apple’s Weather app and use it in their projects via a Swift API, and a REST API for use on other platforms like Android.

The news that would finally allow developers to create like-for-like weather apps for iPad, using the same tools and functionality as the native app for iPhones, comes as Apple also announced iPad would finally receive its own Apple weather app after years without the tablet shipping with one.

The API doesn’t come entirely free and Apple will charge users according to how many app calls are made to its service per month. 500,000 API calls or fewer are free, but charges begin at $49.99 for 1 million monthly calls and rise to $999.99 for 20 million monthly API calls.

Apple’s WidgetKit also gets an update that will allow developers to create modern widgets for Apple’s revamped iPhone lock screen and Apple Watch using the same code.

Xcode updates

Built directly into Apple’s Xcode IDE, Xcode Cloud is now available to developers with several subscription plans depending on the project’s demands.

The continuous integration and delivery (CI/CD) service allows developers to test and deliver apps quicker by using cloud-based tools to run automated tests on multiple devices to check the health of a project in the background while development continues.

The results of the automated tests, plus crash feedback from users, are displayed in one panel directly inside Xcode. It also shows live status indicators and offers filtering options for developers allowing them to monitor only the tasks they need.

Integration with App Store Connect and TestFlight for faster collaboration on in-development features is also supported.

There are also improvements to the Xcode IDE itself, with project builds promised to be up to 25% faster and the Xcode application is now 30% smaller, making for a faster download and install.

Apple said automatic code completion has also become smarter and additional dynamic code snippets allow developers to be more productive by selecting the code they need more quickly.

© Dennis Publishing

Read More:


Comments are closed.

Back to Top ↑