Sample Code - WWDC24 - Apple Developer (original) (raw)
Featured
Destination Video
Leverage SwiftUI to build an immersive media experience in a multiplatform app.
Featured
iOS, iPadOS, macOS, tvOS, visionOS
View code
BOT-anist
Build a multiplatform app that uses windows, volumes, and animations to create a robot botanist's greenhouse.
Featured
iOS, iPadOS, macOS, visionOS
View code
Accessibility
Enhancing the accessibility of your SwiftUI app
Support advancements in SwiftUI accessibility to make your app accessible to everyone.
Accessibility
iOS macOS
View code
App Intents
Making your app’s functionality available to Siri
Add assistant schemas to your app so Siri can complete requests, and integrate your app with Apple Intelligence, Spotlight, and other system experiences.
App Intents
iOS macOS
View code
ARKit
Building local experiences with room tracking
Use room tracking in visionOS to provide custom interactions with physical spaces.
ARKit
visionOS
View code
Exploring object tracking with ARKit
Find and track real-world objects in visionOS using reference objects trained with Create ML.
ARKit
visionOS
View code
Audio and video
Capturing system audio with Core Audio taps
Use a Core Audio tap to capture outgoing audio from a process or group of processes.
Audio and video
macOS
View code
Generating spatial audio from a multichannel audio stream
Convert 8-channel audio to 2-channel spatial audio by using a spatial mixer audio unit.
Audio and video
iOS macOS
View code
Converting side-by-side 3D video to multiview HEVC and spatial video
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.
Audio and video
macOS
View code
Providing an integrated view of your timeline when playing HLS interstitials
Go beyond simple ad insertion with point and fill occupancy HLS interstitials.
Audio and video
iOS
View code
Creating a MIDI device driver
Implement a configurable virtual MIDI driver as a driver extension that runs in user space in macOS and iPadOS.
Audio and video
iOS macOS DriverKit
View code
Bluetooth
Authorizing a Bluetooth accessory to share a dice roll
Discover and set up a specific Bluetooth accessory without requesting permission to use Bluetooth.
Bluetooth
iOS
View code
Contacts
Accessing a person’s contact data using Contacts and ContactsUI
Allow people to grant your app access to contact data by adding the Contact access button and Contact access picker to your app.
Contacts
iOS
View code
Core ML
Integrating a Core ML Model into Your App
Add a simple model to an app, pass input data to the model, and process the model’s predictions.
Core ML
iOS
View code
Group Activities
Customizing spatial Persona templates
Arrange spatial Personas in a team-based guessing game.
Group Activities
visionOS
View code
Health and fitness
Customizing workouts with WorkoutKit
Create, preview, and sync workouts for use in the Workout app on Apple Watch.
Health and fitness
iOS
View code
Visualizing HealthKit State of Mind in visionOS
Learn how to incorporate HealthKit State of Mind into your app and visualize the data in visionOS.
Health and fitness
iOS visionOS
View code
Maps and location
Monitoring location changes with Core Location
Define boundaries and act on user location updates.
Maps and location
iOS
View code
Adopting live updates in Core Location
Simplify location delivery using asynchronous events in Swift.
Maps and location
iOS
View code
Interacting with nearby points of interest
Provide automatic search completions for a partial search query, search the map for relevant locations nearby, and retrieve details for selected points of interest.
Maps and location
iOS
View code
Metal
Processing HDR Images with Metal
Implement a post-processing pipeline using the latest features on Apple GPUs.
Metal
iOS macOS tvOS
View code
Rendering reflections in real time using ray tracing
Implement realistic real-time lighting by dynamically generating reflection maps by encoding a ray-tracing compute pass.
Metal
iOS macOS
View code
PencilKit
Configuring the PencilKit tool picker
Incorporate a custom PencilKit tool picker with a variety of system and custom tools into a drawing app.
PencilKit
iOS visionOS
View code
Photos and camera
Capturing consistent color images
Add the power of a photography studio and lighting rig to your app with the new Constant Color API.
Photos and camera
iOS
View code
Writing spatial photos
Create spatial photos for visionOS by packaging a pair of left- and right-eye images as a stereo HEIC file with related spatial metadata.
Photos and camera
macOS
View code
AVCam: Building a camera app
Capture photos and record video using the front and rear iPhone and iPad cameras.
Photos and camera
iOS
View code
RealityKit
Presenting an artist’s scene
Display a scene from Reality Composer Pro in visionOS.
RealityKit
visionOS
View code
Creating a Spaceship game
Build an immersive game using RealityKit audio, simulation, and rendering features.
RealityKit
iOS visionOS
View code
Creating a spatial drawing app with RealityKit
Use low-level mesh and texture APIs to achieve fast updates to a person's brush strokes by integrating RealityKit with ARKit and SwiftUI.
RealityKit
visionOS
View code
Building an object reconstruction app
Reconstruct objects from user-selected input images by using photogrammetry.
RealityKit
macOS
View code
Construct an immersive environment for visionOS
Build efficient custom worlds for your app.
RealityKit
visionOS
View code
Transforming RealityKit entities using gestures
Build a RealityKit component to support standard visionOS gestures on any entity.
RealityKit
visionOS
View code
Simulating particles in your visionOS app
Add a range of visual effects to a RealityKit view by attaching a particle emitter component to an entity.
RealityKit
visionOS
View code
Simulating physics with collisions in your visionOS app
Create entities that behave and react like physical objects in a RealityKit view.
RealityKit
visionOS
View code
Rendering a windowed game in stereo
Bring an iOS or iPadOS game to visionOS and enhance it.
RealityKit
visionOS
View code
Composing interactive 3D content with RealityKit and Reality Composer Pro
Build an interactive scene using an animation timeline.
RealityKit
visionOS
View code
Combining 2D and 3D views in an immersive app
Use attachments to place 2D content relative to 3D content in an immersive space.
RealityKit
visionOS
View code
Swift
Updating an app to use strict concurrency
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.
Swift
iOS watchOS
View code
Swift Charts
Creating a data visualization dashboard with Swift Charts
Visualize an entire data collection efficiently by instantiating a single vectorized plot in Swift Charts.
Swift Charts
iOS macOS visionOS
View code
SwiftData
Adopting SwiftData for a Core Data app
Persist data in your app intuitively with the Swift native persistence framework.
SwiftData
iOS macOS tvOS
View code
SwiftUI
Creating a tvOS media catalog app in SwiftUI
Build standard content lockups and rows of content shelves for your tvOS app.
SwiftUI
tvOS
View code
Creating visual effects with SwiftUI
Add scroll effects, rich color treatments, custom transitions, and advanced effects using shaders and a text renderer.
SwiftUI
iOS
View code
Customizing window styles and state-restoration behavior in macOS
Configure how your app’s windows look and function in macOS to provide an engaging and more coherent experience.
SwiftUI
macOS
View code
Building a document-based app with SwiftUI
Create, save, and open documents in a multiplatform app.
SwiftUI
iOS macOS
View code
Enhancing your app’s content with tab navigation
Keep your app content front and center while providing quick access to navigation using the tab bar.
SwiftUI
iOS macOS tvOS visionOS
View code
TabletopKit
Creating tabletop games
Develop a spatial board game where multiple players interact with pieces on a table.
TabletopKit
visionOS
View code
Translation
Translating text within your app
Display simple system translations and create custom translation experiences.
Translation
iOS macOS
View code
VisionOS
Diorama
Design scenes for your visionOS app using Reality Composer Pro.
VisionOS
Diorama
View code
Hello World
Use windows, volumes, and immersive spaces to teach people about the Earth.
VisionOS
visionOS
View code
Happy Beam
Leverage a Full Space to create a fun game using ARKit.
VisionOS
visionOS
View code
Building an immersive media viewing experience
Walk through the process of setting up assignments and recording student progress.
VisionOS
visionOS
View code
Swift Splash
Use RealityKit to create an interactive ride in visionOS.
VisionOS
visionOS
View code
Interacting with virtual content blended with passthrough
Present a mixed immersion style space to draw content in a person’s surroundings, and choose how upper limbs appear with respect to rendered content.
VisionOS
visionOS
View code
Enabling video reflections in an immersive environment
Create a more immersive experience by adding video reflections in a custom environment.
VisionOS
visionOS
View code
Wallet
Implementing Wallet Extensions
Support adding an issued card to Apple Pay from directly within Apple Wallet using Wallet Extensions.
Wallet
iOS
View code