WWDC 2024

1. Unlock the power of places with MapKit
2. What’s new in Swift
3. Meet Swift Testing
4. What’s new in Wallet and Apple Pay
5. Create Custom Visual Effects with SwiftUi
6. Swift Charts: Vectorized and function plots
7. What’s new in App Store Connect
8. Catch up on accessibility in SwiftUI
9. Meet the Translation API
10. Move to Swift 6
11. Extend your app’s controls across the system
12. Analyze heap memory

This year, the Apple Worldwide Developer Conference has announced numerous new features, and our iOS team has analyzed the most interesting ones for our projects and developments.

Unlock the power of places with MapKit

Apple has introduced a new way to reference places on maps using a Place ID, which can be referenced from an MKMapItem object using the “identifier” property.

To find these Place IDs, Apple has released a web tool called Place ID Lookup, through which we can extract the ID of a place and use it in apps.

These IDs allow for unique and invariant referencing of places, businesses, and points of interest. These IDs are persistent, and accessing them ensures that you always have the most up-to-date information about the place.

To view the details of the place, we have three presentation options: full, compact, and link.

They have also improved the Maps API to make it easier to find places using search filters, region priority, and pagination.

The aforementioned features are available in UIKit, SwiftUI, and JavaScript, allowing these improvements to be brought to the web as well.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10097/

What’s new in Swift

The Swift programming language turns 10 years old, and over this time, an entire ecosystem has been built around it, which includes, in addition to the language itself, tools, packages, and even the developer community. The community has grown and structured itself into working groups. Additionally, new groups are being created, such as the ecosystem group or the embedded development group. All of them can be found at: https://www.swift.org/community/

Swift continues to expand to other platforms such as Windows and Linux (this year including Fedora and Debian).

On the other hand, for development environments other than Xcode, SourceKit LSP has been developed, a language server implementation that allows IDEs and editors to integrate Swift support.

Among the key Swift libraries, we find Foundation, which has been rewritten in Swift, with higher quality and performance, as well as new functionalities. Swift Testing is emerging as the default solution for testing. Additionally, code compilation in Xcode has been improved through parallel compilation of separate modules.

The Swift repository has moved to https://github.com/swiftlang/along with Swift Compiler, Foundation, and other ecosystem packages.

Finally, updates have been made to the Swift language, such as: non-copyable types, embedded Swift, interoperability with C++, typed throws, data race safety, and low-level synchronization of primitives.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10136/

Meet Swift Testing

Another of the most notable new features presented this year is Swift Testing. A new open-source library for testing our code using Swift, which is also compatible with major platforms, including Linux and Windows.

It includes powerful functions to describe and organize tests, provides actionable details when any test fails, and adapts very well to projects with a large codebase. Having been designed for the Swift language, it makes use of modern features such as concurrency and macros.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10179/

What’s new in Wallet and Apple Pay

Within Wallet and Apple Pay, improvements have been introduced regarding payments and ticketing.

Related to payments, the main new feature is the ability to make payments with Apple Pay in browsers other than Safari. To achieve this, the Apple Pay SDK for JavaScript has been updated, adding a new canMakePayments() method to check the device’s status for making payments with Apple Pay. This new method returns one of four possible states:

  • paymentCredentialsAvailable, which indicates that the device supports Apple Pay and has active cards. In this case, the Apple Pay button should be shown as the first option.
  • paymentCredentialsUnavailable, which indicates that the device supports Apple Pay but does not have active cards for use. In this case, the Apple Pay button should not be shown.
  • paymentCredentialsStatusUnknown, which indicates that the device supports Apple Pay but the card data cannot be obtained.
  • applePayUnsupported, which indicates that the device does not support Apple Pay. In this case, the button should not be shown.

Another noteworthy feature related to payments is that refunds are now allowed in environments other than Safari or Apple devices. These refunds can come from a bank account or another type of account with stored value. The requirements are very similar to the current PaymentRequest.

Related to ticketing, the main new feature is the redesign of event tickets. A new format has been added, with a central image of the event, new titles and time formats, and a footer with information related to event entry (seats, entrance gate, row, etc.). Additionally, the integration of other apps like Maps or Weather has been improved to provide more information about the event. It is also worth noting that a new module called Event Guide has been added within the ticket, which takes us to a second screen with more related information, such as links to buy merchandise, food, the event’s website, etc. This screen also shows weather information, a map of the venue, opening hours, and even if it is a musical event, Apple gives us the possibility to recommend related music within this module. All this new information and format are configured through the pass.json, with tags related to the modules. Finally, another new feature related to the ticket is that a live activity will now be shown on the lock screen when the event date is near, displaying the most relevant information about it.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10108/

Create Custom Visual Effects with SwiftUi

We also found a tutorial on how to create custom visual effects to enhance our applications.

It explains how to create:

  • Scroll effects: rotation fx, Parallax fx, Hue rotation.
  • Color effects: Mesh Gradients, introduced in iOS 18.
  • Custom transitions: Transitions by creating a struct of type Transition, TextRenderer.

All these customized visual effects help us improve the personality of our applications and their user experience.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10151/

Swift Charts: Vectorized and function plots

In this new version of iOS, they have expanded the functionalities of Swift Charts, which were introduced in iOS 16, by adding 3 new types of graphical representations.

  • Function plots: They show the graphical representation on a plane of a mathematical equation or system of equations. There are two types:
    • LinePlot: Draws the line of the equation or system.
    • AreaPlot: Draws the area between two equations. Vectorized plots: Represents a set of coordinates on the plane.

All these functions are parameterizable, customizable, and can be combined with each other.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10155/

What’s new in App Store Connect

There have also been improvements regarding app publishing and testing:

New ways to highlight applications:

  • Nominations for highlighting: Developers can submit future content plans and app improvements through App Store Connect to be considered by Apple’s editorial team for featuring on the App Store. This process includes providing details about new features, their expected release date, and any additional relevant information.

Improvements in TestFlight:

  • Updated invitation experience: Invitations to test beta apps now include key details such as the app name and icon, screenshots, and detailed descriptions to attract testers.
  • Criteria for public links: Developers can set specific criteria (such as OS versions and device types) for testers using public links, ensuring that tests are relevant and effective.
  • Enrollment metrics: App Store Connect now shows detailed statistics on how public links are performing, allowing developers to adjust their testing strategies.

New features to reach customers:

  • Deep Links for custom product pages: It is now possible to add deep links to custom product pages, improving the user experience by directing them to a specific section of the app from a marketing campaign or ad.
  • Promote your app: The new feature in the App Store Connect app allows you to easily generate and share marketing assets for important events, such as launches or updates, directly on social media from an iPhone or iPad.

Other improvements in the developer ecosystem:

  • Reduction in required screenshots: Now only one set of screenshots is needed for iPhone and another for iPad.
  • API support for the Enterprise Developer Program: Access to APIs for user and provisioning management.
  • Download app analytics reports: Up to 50 new reports on App Store engagement, downloads, sales, and app usage can be exported through the App Store Connect API.

These new features and improvements are designed to facilitate the app testing and promotion process, helping developers gain more visibility and improve the user experience on the App Store.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10063/

Catch up on accessibility in SwiftUI

We also have new tools and APIs that allow us to refine the accessibility experience in apps developed with SwiftUI. One of the most notable new features is the improvement in creating accessibility elements. For example, the modifier accessibilityElement(children: .combine) allows combining multiple elements into one, simplifying navigation for VoiceOver users.

New accessibility modifiers have been added that offer greater flexibility and control. The modifier accessibilityLabel(_:isEnabled:) allows applying labels conditionally. This is useful for handling state changes in views.

For content that appears on hover, it is now possible to use accessibilityActions to make these actions available without needing to activate the hover. Additionally, SwiftUI now allows extracting text from views to use as accessibility labels.

Apple has also improved complex interactions such as drag and drop in accessibility contexts. Developers can define specific drag and drop points using accessibilityDropPoint(_:description:).

Regarding widgets, support has been expanded to make them more interactive and accessible. Developers can use App Intents to create custom accessibility actions in widgets.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10073/

Meet the Translation API

There are also advancements in their translation API, which is already being used today in Apple’s own translation app, as well as in any other system application (for example, the Messages app) and in the camera app when it detects text.

The different types of translation it handles are presented. On one hand, there is simple translation (available since iOS 17.4), which with a single line of Swift code can perform a quick and simple translation on any Apple platform, such as macOS, iPadOS, and iOS.

On the other hand, there is Flexible Translation (available since iOS 18), which allows adjusting the source and target languages, as well as changes in configuration, etc.

It is more complex to implement but offers a much faster and smoother user experience.

All of this can be seen implemented in a demo hiking app where users comment on hikes in their different languages, showcasing the full power of this translation API.

Finally, they offer a series of implementation tips and best practices.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10117/

Move to Swift 6

Swift 6 comes with numerous updates, including improvements in concurrency to eliminate data races, which are situations where multiple threads of the main process simultaneously access a specific piece of data.

The video explains that before switching to Swift 6, several changes need to be made. The first involves updating how strictly you want concurrency checks implemented in the code. This is important because it is the only new feature that is mandatory in Swift 6; the others can be optionally enabled.

Once this variable is updated in the project’s build settings, you need to address the warnings related to concurrency. Many of these warnings are due to variables not being declared as main actors in the main threads. Apple provides a series of annotations to give you the most control over these situations. Once this is resolved, you can switch to Swift 6.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10169/

Extend your app’s controls across the system

Another new feature in controls is a new type of widget in iOS 18.

A new way to extend your app’s functionality to system spaces, such as the Control Center, the lock screen, and the action button, created with WidgetKit (available since iOS 14).

They are created similarly to a widget. There are two types:

  • Buttons: perform direct actions.
  • Switch: change the state of a boolean.

Controls are actions that take the visual form of the system space they are in, using information provided by the app: a symbol, a title, a color tone, and additional content to the system.

In the Control Center, they can be displayed in any of the three different sizes, so the title and additional content will not always be visible.

There are three types of events that cause the system to reload the control: when the control action is performed, when the app requests a control reload, and when a push notification invalidates the control.

Asynchronously using a ValueProvider and the push notification API, I can see the control state update from different devices.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10157/

Analyze heap memory

Applications use dynamic memory directly or indirectly, and in this latest presentation, they show us how we can control and optimize memory usage.

Within Xcode tools, they present those that can help us understand and solve problems we may have if we manage memory poorly: Instruments. We can use it to read and understand data, statistics, measure the heap, and look for memory growth patterns. It is even possible to save the generated trace to share with the development team and analyze it.

It is important to control memory spikes because they put pressure on it and cause the system to react. In the long term, this leads to fragmentation and holes in heap memory regions. Often, they are caused by cyclic references to variables. With these tools, they are easier to detect and solve.

Among the recommended techniques and best practices for diagnosing transient growth, persistent growth, and leaks in your application, they emphasize:

  • Not skipping ARC
  • Enabling whole-module-optimization
  • Frequently used structs should have simple fields.

Finally, it is recommended to use Xcode Memory Graph Debugger and MallocStackLogging tools once heap memory issues have been detected to find out more about their origin and causes.

Oficial Video: https://developer.apple.com/videos/play/wwdc2024/10173/

Compartir artículo