22 min read

Abundance of code samples (WWDC24)

Abundance of code samples (WWDC24)

Apple has made strides toward producing and updating sample code this year (as mentioned earlier). But discoverability could be boosted IMO. Currently, we do have a canonical categorization by technology, but it can be helpful to be able to browse through the same materials grouped by the session that they were referenced (it better captures the very nature of those projects as cross-technology).

So, here is such a list for this year:

TOC

ℹ️
Topics that didn't have any sample code mentioned in its sessions aren't linked

Accessibility & Inclusion

Enhancing the accessibility of your SwiftUI app | Apple Developer Documentation
Support advancements in SwiftUI accessibility to make your app accessible to everyone.

App Services

Accelerating app interactions with App Intents | Apple Developer Documentation
Enable people to use your app’s features quickly through Siri, Spotlight, and Shortcuts.
Accessing a person’s contact data using Contacts and ContactsUI | Apple Developer Documentation
Allow people to grant your app access to contact data by adding the Contact access button and Contact access picker to your app.
Adopting SwiftData for a Core Data app | Apple Developer Documentation
Persist data in your app intuitively with the Swift native persistence framework.
Configuring the PencilKit tool picker | Apple Developer Documentation
Incorporate a custom PencilKit tool picker with a variety of system and custom tools into a drawing app.
Connecting to a service with passkeys | Apple Developer Documentation
Allow users to sign in to a service without typing a password.
Creating a data visualization dashboard with Swift Charts | Apple Developer Documentation
Visualize an entire data collection efficiently by instantiating a single vectorized plot in Swift Charts.
Customizing spatial Persona templates | Apple Developer Documentation
Arrange spatial Personas in a team-based guessing game.
Interacting with nearby points of interest | Apple Developer Documentation
Provide automatic search completions for a partial search query, search the map for relevant locations nearby, and retrieve details for selected points of interest.
Making your app’s functionality available to Siri | Apple Developer Documentation
Add assistant schemas to your app and integrate your app with Siri and Apple Intelligence, and support system experiences like Spotlight.
Translating text within your app | Apple Developer Documentation
Display simple system translations and create custom translation experiences.
Visualizing HealthKit State of Mind in visionOS | Apple Developer Documentation
Learn how to incorporate HealthKit State of Mind into your app and visualize the data in visionOS.

Audio & Video

Building an immersive media viewing experience | Apple Developer Documentation
Add a deeper level of immersion to media playback in your app with RealityKit and Reality Composer Pro.
Creating a tvOS media catalog app in SwiftUI | Apple Developer Documentation
Build standard content lockups and rows of content shelves for your tvOS app.
Customizing spatial Persona templates | Apple Developer Documentation
Arrange spatial Personas in a team-based guessing game.
Destination Video | Apple Developer Documentation
Leverage SwiftUI to build an immersive media experience in a multiplatform app.
Enabling video reflections in an immersive environment | Apple Developer Documentation
Create a more immersive experience by adding video reflections in a custom environment.
Providing an integrated view of your timeline when playing HLS interstitials | Apple Developer Documentation
Go beyond simple ad insertion with point and fill occupancy HLS interstitials.

Design

Accelerating app interactions with App Intents | Apple Developer Documentation
Enable people to use your app’s features quickly through Siri, Spotlight, and Shortcuts.
Building an immersive media viewing experience | Apple Developer Documentation
Add a deeper level of immersion to media playback in your app with RealityKit and Reality Composer Pro.
Creating visual effects with SwiftUI | Apple Developer Documentation
Add scroll effects, rich color treatments, custom transitions, and advanced effects using shaders and a text renderer.
Destination Video | Apple Developer Documentation
Leverage SwiftUI to build an immersive media experience in a multiplatform app.
Enabling video reflections in an immersive environment | Apple Developer Documentation
Create a more immersive experience by adding video reflections in a custom environment.
Enhancing your app’s content with tab navigation | Apple Developer Documentation
Keep your app content front and center while providing quick access to navigation using the tab bar.
Incorporating real-world surroundings in an immersive experience | Apple Developer Documentation
Create an immersive experience by making your app’s content respond to the local shape of the world.

Developer Tools

Building an object reconstruction app | Apple Developer Documentation
Reconstruct objects from user-selected input images by using photogrammetry.
Composing interactive 3D content with RealityKit and Reality Composer Pro | Apple Developer Documentation
Build an interactive scene using an animation timeline.
Creating a Spaceship game | Apple Developer Documentation
Build an immersive game using RealityKit audio, simulation, and rendering features.
Creating a spatial drawing app with RealityKit | Apple Developer Documentation
Use low-level mesh and texture APIs to achieve fast updates to a person’s brush strokes by integrating RealityKit with ARKit and SwiftUI.
Drawing paths and shapes | Apple Developer Documentation
Users receive a badge whenever they visit a landmark in their list. Of course, for a user to receive a badge, you’ll need to create one. This tutorial takes you through the process of creating a badge by combining paths and shapes, which you then overlay with another shape that represents the location.
Rendering reflections in real time using ray tracing | Apple Developer Documentation
Implement realistic real-time lighting by dynamically generating reflection maps by encoding a ray-tracing compute pass.
Scanning objects using Object Capture | Apple Developer Documentation
Implement a full scanning workflow for capturing objects on iOS devices.
Updating an app to use strict concurrency | Apple Developer Documentation
Use this code to follow along with a guide to migrating your code to take advantage of the full concurrency protection that the Swift 6 language mode provides.

Graphics & Games

Building an object reconstruction app | Apple Developer Documentation
Reconstruct objects from user-selected input images by using photogrammetry.
Creating a Spaceship game | Apple Developer Documentation
Build an immersive game using RealityKit audio, simulation, and rendering features.
Creating a spatial drawing app with RealityKit | Apple Developer Documentation
Use low-level mesh and texture APIs to achieve fast updates to a person’s brush strokes by integrating RealityKit with ARKit and SwiftUI.
Creating tabletop games | Apple Developer Documentation
Develop a spatial board game where multiple players interact with pieces on a table.
Creating visual effects with SwiftUI | Apple Developer Documentation
Add scroll effects, rich color treatments, custom transitions, and advanced effects using shaders and a text renderer.
Drawing paths and shapes | Apple Developer Documentation
Users receive a badge whenever they visit a landmark in their list. Of course, for a user to receive a badge, you’ll need to create one. This tutorial takes you through the process of creating a badge by combining paths and shapes, which you then overlay with another shape that represents the location.
Presenting an artist’s scene | Apple Developer Documentation
Display a scene from Reality Composer Pro in visionOS.
Rendering a windowed game in stereo | Apple Developer Documentation
Bring an iOS or iPadOS game to visionOS and enhance it.
Rendering reflections in real time using ray tracing | Apple Developer Documentation
Implement realistic real-time lighting by dynamically generating reflection maps by encoding a ray-tracing compute pass.
Scanning objects using Object Capture | Apple Developer Documentation
Implement a full scanning workflow for capturing objects on iOS devices.

Health & Fitness

Bringing multiple windows to your SwiftUI app | Apple Developer Documentation
Compose rich views by reacting to state changes and customize your app’s scene presentation and behavior on iPadOS and macOS.
Visualizing HealthKit State of Mind in visionOS | Apple Developer Documentation
Learn how to incorporate HealthKit State of Mind into your app and visualize the data in visionOS.

Machine Learning & AI

Accelerating app interactions with App Intents | Apple Developer Documentation
Enable people to use your app’s features quickly through Siri, Spotlight, and Shortcuts.
Capturing consistent color images | Apple Developer Documentation
Add the power of a photography studio and lighting rig to your app with the new Constant Color API.
Exploring object tracking with ARKit | Apple Developer Documentation
Find and track real-world objects in visionOS using reference objects trained with Create ML.
Making your app’s functionality available to Siri | Apple Developer Documentation
Add assistant schemas to your app and integrate your app with Siri and Apple Intelligence, and support system experiences like Spotlight.
Translating text within your app | Apple Developer Documentation
Display simple system translations and create custom translation experiences.

Maps & Location

Adopting live updates in Core Location | Apple Developer Documentation
Simplify location delivery using asynchronous events in Swift.
Interacting with nearby points of interest | Apple Developer Documentation
Provide automatic search completions for a partial search query, search the map for relevant locations nearby, and retrieve details for selected points of interest.

Photos & Camera

AVCam: Building a camera app | Apple Developer Documentation
Capture photos and record video using the front and rear iPhone and iPad cameras.
Capturing consistent color images | Apple Developer Documentation
Add the power of a photography studio and lighting rig to your app with the new Constant Color API.
Converting side-by-side 3D video to multiview HEVC and spatial video | Apple Developer Documentation
Create video content for visionOS by converting an existing 3D HEVC file to a multiview HEVC format, optionally adding spatial metadata to create a spatial video.
Writing spatial photos | Apple Developer Documentation
Create spatial photos for visionOS by packaging a pair of left- and right-eye images as a stereo HEIC file with related spatial metadata.

Privacy & Security

Adopting live updates in Core Location | Apple Developer Documentation
Simplify location delivery using asynchronous events in Swift.
Authorizing a Bluetooth accessory to share a dice roll | Apple Developer Documentation
Discover, select, and set up a specific Bluetooth accessory without requesting permission to use Bluetooth.
Connecting to a service with passkeys | Apple Developer Documentation
Allow users to sign in to a service without typing a password.

Safari & Web

Interacting with nearby points of interest | Apple Developer Documentation
Provide automatic search completions for a partial search query, search the map for relevant locations nearby, and retrieve details for selected points of interest.

Spatial Computing

AVCam: Building a camera app | Apple Developer Documentation
Capture photos and record video using the front and rear iPhone and iPad cameras.
BOT-anist | Apple Developer Documentation
Build a multiplatform app that uses windows, volumes, and animations to create a robot botanist’s greenhouse.
Bringing multiple windows to your SwiftUI app | Apple Developer Documentation
Compose rich views by reacting to state changes and customize your app’s scene presentation and behavior on iPadOS and macOS.
Building an immersive media viewing experience | Apple Developer Documentation
Add a deeper level of immersion to media playback in your app with RealityKit and Reality Composer Pro.
Building an object reconstruction app | Apple Developer Documentation
Reconstruct objects from user-selected input images by using photogrammetry.
Building local experiences with room tracking | Apple Developer Documentation
Use room tracking in visionOS to provide custom interactions with physical spaces.
Composing interactive 3D content with RealityKit and Reality Composer Pro | Apple Developer Documentation
Build an interactive scene using an animation timeline.
Converting side-by-side 3D video to multiview HEVC and spatial video | Apple Developer Documentation
Create video content for visionOS by converting an existing 3D HEVC file to a multiview HEVC format, optionally adding spatial metadata to create a spatial video.
Creating a Spaceship game | Apple Developer Documentation
Build an immersive game using RealityKit audio, simulation, and rendering features.
Creating a spatial drawing app with RealityKit | Apple Developer Documentation
Use low-level mesh and texture APIs to achieve fast updates to a person’s brush strokes by integrating RealityKit with ARKit and SwiftUI.
Creating tabletop games | Apple Developer Documentation
Develop a spatial board game where multiple players interact with pieces on a table.
Customizing spatial Persona templates | Apple Developer Documentation
Arrange spatial Personas in a team-based guessing game.
Destination Video | Apple Developer Documentation
Leverage SwiftUI to build an immersive media experience in a multiplatform app.
Drawing paths and shapes | Apple Developer Documentation
Users receive a badge whenever they visit a landmark in their list. Of course, for a user to receive a badge, you’ll need to create one. This tutorial takes you through the process of creating a badge by combining paths and shapes, which you then overlay with another shape that represents the location.
Enabling video reflections in an immersive environment | Apple Developer Documentation
Create a more immersive experience by adding video reflections in a custom environment.
Exploring object tracking with ARKit | Apple Developer Documentation
Find and track real-world objects in visionOS using reference objects trained with Create ML.
Incorporating real-world surroundings in an immersive experience | Apple Developer Documentation
Create an immersive experience by making your app’s content respond to the local shape of the world.
Presenting an artist’s scene | Apple Developer Documentation
Display a scene from Reality Composer Pro in visionOS.
Rendering a windowed game in stereo | Apple Developer Documentation
Bring an iOS or iPadOS game to visionOS and enhance it.
Scanning objects using Object Capture | Apple Developer Documentation
Implement a full scanning workflow for capturing objects on iOS devices.
Visualizing HealthKit State of Mind in visionOS | Apple Developer Documentation
Learn how to incorporate HealthKit State of Mind into your app and visualize the data in visionOS.
Writing spatial photos | Apple Developer Documentation
Create spatial photos for visionOS by packaging a pair of left- and right-eye images as a stereo HEIC file with related spatial metadata.

Swift

Adopting SwiftData for a Core Data app | Apple Developer Documentation
Persist data in your app intuitively with the Swift native persistence framework.
GitHub - apple/swift-embedded-examples: A collection of example projects using Embedded Swift
A collection of example projects using Embedded Swift - apple/swift-embedded-examples
GitHub - apple/swift-matter-examples: An Embedded Swift Matter application running on ESP32-C6
An Embedded Swift Matter application running on ESP32-C6 - apple/swift-matter-examples
Updating an app to use strict concurrency | Apple Developer Documentation
Use this code to follow along with a guide to migrating your code to take advantage of the full concurrency protection that the Swift 6 language mode provides.

SwiftUI & UI Frameworks

Accessing a person’s contact data using Contacts and ContactsUI | Apple Developer Documentation
Allow people to grant your app access to contact data by adding the Contact access button and Contact access picker to your app.
BOT-anist | Apple Developer Documentation
Build a multiplatform app that uses windows, volumes, and animations to create a robot botanist’s greenhouse.
Building a document-based app with SwiftUI | Apple Developer Documentation
Create, save, and open documents in a multiplatform app.
Configuring the PencilKit tool picker | Apple Developer Documentation
Incorporate a custom PencilKit tool picker with a variety of system and custom tools into a drawing app.
Creating a data visualization dashboard with Swift Charts | Apple Developer Documentation
Visualize an entire data collection efficiently by instantiating a single vectorized plot in Swift Charts.
Creating a tvOS media catalog app in SwiftUI | Apple Developer Documentation
Build standard content lockups and rows of content shelves for your tvOS app.
Creating custom container views | Apple Developer Documentation
Access individual subviews to compose flexible container views.
Creating visual effects with SwiftUI | Apple Developer Documentation
Add scroll effects, rich color treatments, custom transitions, and advanced effects using shaders and a text renderer.
Customizing window styles and state-restoration behavior in macOS | Apple Developer Documentation
Configure how your app’s windows look and function in macOS to provide an engaging and more coherent experience.
Destination Video | Apple Developer Documentation
Leverage SwiftUI to build an immersive media experience in a multiplatform app.
Enhancing the accessibility of your SwiftUI app | Apple Developer Documentation
Support advancements in SwiftUI accessibility to make your app accessible to everyone.
Enhancing your app’s content with tab navigation | Apple Developer Documentation
Keep your app content front and center while providing quick access to navigation using the tab bar.

System Services

Authorizing a Bluetooth accessory to share a dice roll | Apple Developer Documentation
Discover, select, and set up a specific Bluetooth accessory without requesting permission to use Bluetooth.
Connecting to a service with passkeys | Apple Developer Documentation
Allow users to sign in to a service without typing a password.