View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 代码
  • 探索 Spatial Preview 框架

    了解新的 Spatial Preview 框架如何将 Mac 上的内容直接带到 visionOS。探索如何通过跨两个平台进行实时同步和双向编辑来构建动态工作流程。了解 SpatialPreview API、设备发现、2D 和 3D 会话集成,以及新的快速查看功能,为你的 Mac App 提升空间体验。

    章节

    • 0:00 - Introduction
    • 2:37 - Learn about Spatial Preview
    • 3:30 - Document Preview
    • 6:36 - USD Preview
    • 9:16 - Editing Features
    • 13:28 - Next steps

    资源

    • Reducing the rendering cost of RealityKit content on visionOS
    • Spatial Preview
      • 高清视频
      • 标清视频

    相关视频

    WWDC26

    • 在 visionOS 中协作处理结构化 3D 模型
    • 探索 USDKit 以及 OpenUSD 的新进展

    WWDC22

    • 掌握 USD 基础知识
  • 搜索此视频…
    • 3:58 - Document Preview Session with Device Picker

      // Send and update documents using the Spatial Preview framework
      
      import SwiftUI
      import SpatialPreview
      let deviceObserver = ConnectedSpatialEndpointObserver()
      
      let previewSession = DocumentPreviewSession(name: "Immersive.aivu", contentType: .aivu)
      
      func startPreview(contentURL: URL, endpoint: SpatialPreviewEndpoint) async throws {
          let endpoint = try await deviceObserver.endpoint
          try await previewSession.start(endpoint: endpoint)
          try await previewSession.updateContents(url: contentURL)
      }
      
      @State var showDevicePicker: Bool = false
      
      var body: some View {
          ...
          .sheet(isPresented: $showDevicePicker) {
              SpatialPreviewDevicePicker(isPresented: $showDevicePicker) { endpoint in
                  showDevicePicker = false
                  Task {
                      try await startPreview(filename: filename, endpoint: endpoint)
                  }
              }
          }
      }
    • 5:20 - Update Document Contents

      // Send and update documents using the Spatial Preview framework
      
      import SwiftUI
      import SpatialPreview
      
      ForEach(contentURLs, id: \.self) { url in
          Button {
              Task { try await previewSession?.updateContents(url: url) }
          }
      }
      .task(id: previewSession.map { ObjectIdentifier($0) }) {
          for await state in Observations({ session.state }) {
              if state.isInvalidated {
                  previewSession = nil
                  break
              }
          }
      }
      
      try await previewSession?.close()
    • 7:36 - Edit USD Live

      // Edit USD live using USDKit and Spatial Preview
      
      import SpatialPreview
      import USDKit
      
      let deviceObserver = ConnectedSpatialEndpointObserver()
      
      var usdSession: USDPreviewSession?
      
      func shareStage(to endpoint: SpatialPreviewEndpoint) async throws -> USDPreviewSession {
          let endpoint = try await deviceObserver.endpoint
      
          let stageURL = Bundle.main.url(forResource: "sampleScene", withExtension: "usdz")
          let stage = try USDStage.open(stageURL)
          usdSession = USDPreviewSession(stage: stage)
      
          try await usdSession?.start(endpoint: endpoint)
      }
    • 8:56 - Opt out of optimization

      // Optimization
      
      import SpatialPreview
      
      
      
      
      let endpoint = try await deviceObserver.endpoint
      do {
          try await usdSession.start(endpoint: endpoint, parameters: .unmodified)
      } catch USDPreviewSession.Error.assetUnshareable {
          // Handle Asset Unshareable error
      }
    • 10:10 - USD Layout Variants

      // LayoutVariants.usda
      #usda 1.0
      over "furniture" (
          variantSets = "Layout"
          variants = { string Layout = "LayoutA" }
      )
      {
          variantSet "Layout" = {
              "LayoutA" {
                  // Default furniture position and rotation
              }
              "LayoutB" {
                  // Moves furniture prims to a different position and rotation
              }
              ...
          }
      }
    • 10:17 - Edit USD live using USDKit and Spatial Preview

      // Edit USD live using USDKit and Spatial Preview
      
      import SpatialPreview
      import USDKit
      
      func applyLayoutVariant(named layoutVariantName: String) throws {
          let prim = stage.prim(at: SdfPath("/root/furniture"))
          try prim.variantSets?.setSelection("Layout", variantName: layoutVariantName)
      }
    • 10:49 - USD Stage Observations

      // Edit USD live using Spatial Preview
      
      import SpatialPreview
      import USDKit
      
      let observerToken: ObservationToken
      
      observerToken = stage.addObserver(for: UsdStage.ObjectsDidChange.self) { notice in
          for path in notice.resyncedPaths {
              let prim = notice.stage.prim(at: path)
              guard prim.isValid else { continue }
              if prim.isAnnotation {
                  // Handle annotation change
                  break
              }
          }
      }
    • 11:13 - Annotation Spec

      // Annotation spec example
      
      AppleTextAnnotation {
          // The textual representation of this annotation
          string text
      
          // The identifier for this specific author
          uniform string author
      
          // An identifier that is unique to your data tracking system
          uniform string identifier
      }
      
      /__documentAnnotationGroup__
    • 11:33 - Metadata for Object Manipulation

      // Metadata required for object manipulation in Quick Look
      
      customData = {
          dictionary apple = {
              bool spatialEditable = 1
          }
      }
    • 12:16 - Session Options and Events

      // Spatial Preview session options and events
      
      import SpatialPreview
      import USDKit
      
      session.start(endpoint: endpoint, options: [.annotations, .perObjectManipulation, .export])
      
      func listenForEvents(session: USDPreviewSession) async {
          for await event in session.events {
              if case .timeChanged(let time) = event {
                  playbackModel.timeCode = time
              } else if case .playbackStateChanged(let isPlaying) = event {
                  playbackModel.playbackStateChanged(isPlaying)
              }
          }
      }
    • 12:38 - Observe Session Progress

      // Observe Spatial Preview session progress
      
      import SpatialPreview
      import USDKit
      
      @State private var sessionProgress: Double = 0
      
      var body: some View {
          ...
          .task(id: usdSession.map { ObjectIdentifier($0) }) {
              guard let session = usdSession else { return }
              for await fraction in Observations({ session.progress.fractionCompleted }) {
                  sessionProgress = fraction
              }
          }
          .overlay(alignment: .bottom) {
              ProgressView(value: sessionProgress)
                  .padding()
          }
      }
    • 0:00 - Introduction
    • The Spatial Preview framework, which lets developers extend content from Mac into visionOS using Mac Virtual Display. Previews what the session covers: an overview of the framework, document preview, and USD preview for live 3D workflows.

    • 2:37 - Learn about Spatial Preview
    • Explores the core components of the Spatial Preview framework: selecting a spatial endpoint, creating a preview session, and launching Quick Look on visionOS. Covers the two session types—Document Preview Session and USD Preview Session—and explains that no visionOS code is required.

    • 3:30 - Document Preview
    • Walks through using DocumentPreviewSession to send files like Apple Immersive Video frames from a Mac app to visionOS. Covers obtaining a Mac Virtual Display endpoint with ConnectedSpatialEndpointObserver, starting a session, providing content URLs, integrating SpatialPreviewDevicePicker in SwiftUI, and using updateContents to build a gallery experience that reuses the same scene.

    • 6:36 - USD Preview
    • Shows how to share and live-edit USD content from a Mac app on visionOS using USDPreviewSession with a USDKit stage. Covers selecting a device, opening a USD stage, starting the session, and handling unshareable assets via the optimization parameter.

    • 9:16 - Editing Features
    • Covers the rich set of Quick Look editing features available through USD Preview: USD layout variants, annotation authoring with AppleTextAnnotation, object manipulation with spatialEditable metadata, and session options including playback events and progress monitoring via ProgressReporter.

    • 13:28 - Next steps
    • Summarizes how to get started with Spatial Preview using USDKit Swift APIs and bridging for existing USD apps. Encourages developers to explore Document Preview Session, USD Preview Session, live editing, SharePlay collaboration, and the full suite of asset review tools.

Developer Footer

  • 视频
  • WWDC26
  • 探索 Spatial Preview 框架
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • Mini Apps Partner Program
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则