View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Work with Reality Composer Pro content in Xcode

    Learn how to bring content from Reality Composer Pro to life in Xcode. We'll show you how to load 3D scenes into Xcode, integrate your content with your code, and add interactivity to your app. We'll also share best practices and tips for using these tools together in your development workflow.

    To get the most out of this session, we recommend first watching “Meet Reality Composer Pro” and “Explore materials in Reality Composer Pro" to learn more about creating 3D scenes.

    Capítulos

    • 0:00 - Introduction
    • 2:37 - Load 3D content
    • 6:27 - Components
    • 12:00 - User Interface
    • 27:51 - Play audio
    • 30:18 - Material properties
    • 33:25 - Wrap-up

    Recursos

      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Build spatial experiences with RealityKit
    • Develop your first immersive app
    • Enhance your spatial computing app with RealityKit
    • Explore materials in Reality Composer Pro
    • Meet Reality Composer Pro

    WWDC21

    • Dive into RealityKit 2
  • Buscar neste vídeo...
    • 3:12 - Loading an entity

      RealityView { content in
          do {
              let entity = try await Entity(named: "DioramaAssembled", in: realityKitContentBundle)
              content.add(entity)
          } catch {
              // Handle error
          }
      }
    • 6:39 - Adding a component

      let component = MyComponent()
      entity.components.set(component)
    • 12:21 - Attachments data flow

      RealityView { _, _ in
          // load entities from your Reality Composer Pro package bundle
      } update: { content, attachments in
                 
         if let attachmentEntity = attachments.entity(for: "🐠") {
           		content.add(attachmentEntity)
       	 }
                 
      } attachments: {
          Button { ... }
             .background(.green)
             .tag("🐠")
      }
    • 15:48 - Adding attachments

      let myEntity = Entity()
      
      RealityView { content, _ in
          if let entity = try? await Entity(named: "MyScene", in: realityKitContentBundle) {
              content.add(entity)
          }
      } update: { content, attachments in
      
          if let attachmentEntity = attachments.entity(for: "🐠") {
              content.add(attachmentEntity)
          }
      
          content.add(myEntity)
      
      } attachments: {
          Button { ... }
             .background(.green)
             .tag("🐠")
      }
    • 20:43 - Adding point of interest attachment entities

      static let markersQuery = EntityQuery(where: .has(PointOfInterestComponent.self))
      @State var attachmentsProvider = AttachmentsProvider()
      
      rootEntity.scene?.performQuery(Self.markersQuery).forEach { entity in
        guard let pointOfInterest = entity.components[PointOfInterestComponent.self] else { return }
        
        let attachmentTag: ObjectIdentifier = entity.id
      
        let view = LearnMoreView(name: pointOfInterest.name, description: pointOfInterest.description)
                                 .tag(attachmentTag)
      
         attachmentsProvider.attachments[attachmentTag] = AnyView(view)
      }
    • 21:40 - AttachmentsProvider

      @Observable final class AttachmentsProvider {
          var attachments: [ObjectIdentifier: AnyView] = [:]
          var sortedTagViewPairs: [(tag: ObjectIdentifier, view: AnyView)] { ... }
      }
      
      ...
      
      @State var attachmentsProvider = AttachmentsProvider()
      
      RealityView { _, _ in
      
      } update: { _, _ in
      
      } attachments: {
          ForEach(attachmentsProvider.sortedTagViewPairs, id: \.tag) { pair in
              pair.view
          }
      }
    • 22:31 - Design-time and Run-time components

      // Design-time component
      public struct PointOfInterestComponent: Component, Codable {
          public var region: Region = .yosemite
          public var name: String = "Ribbon Beach"
          public var description: String?
      }
      
      // Run-time component
      public struct PointOfInterestRuntimeComponent: Component {
          public let attachmentTag: ObjectIdentifier
      }
    • 25:38 - Adding a run-time component for each design-time component

      static let markersQuery = EntityQuery(where: .has(PointOfInterestComponent.self))
      @State var attachmentsProvider = AttachmentsProvider()
      
      rootEntity.scene?.performQuery(Self.markersQuery).forEach { entity in
        guard let pointOfInterest = entity.components[PointOfInterestComponent.self] else { return }
        
        let attachmentTag: ObjectIdentifier = entity.id
      
        let view = LearnMoreView(name: pointOfInterest.name, description: pointOfInterest.description)
                                 .tag(attachmentTag)
      
         attachmentsProvider.attachments[attachmentTag] = AnyView(view)
         let runtimeComponent = PointOfInterestRuntimeComponent(attachmentTag: attachmentTag)
         entity.components.set(runtimeComponent)
      }
    • 26:19 - Adding and positioning the attachment entities

      static let runtimeQuery = EntityQuery(where: .has(PointOfInterestRuntimeComponent.self))
      
      RealityView { _, _ in
      
      } update: { content, attachments in x
         
          rootEntity.scene?.performQuery(Self.runtimeQuery).forEach { entity in
              guard let component = entity.components[PointOfInterestRuntimeComponent.self],
                    let attachmentEntity = attachments.entity(for: component.attachmentTag) else { 
                  return 
              }        
              content.add(attachmentEntity)
              attachmentEntity.setPosition([0, 0.5, 0], relativeTo: entity)
          }
      } attachments: {
          ForEach(attachmentsProvider.sortedTagViewPairs, id: \.tag) { pair in
              pair.view
          }
      }
    • 28:55 - Audio Playback

      func playOceanSound() {
              
          guard let entity = entity.findEntity(named: "OceanEmitter"),
              let resource = try? AudioFileResource(named: "/Root/Resources/Ocean_Sounds_wav",
                                         from: "DioramaAssembled.usda",
                                         in: RealityContent.realityContentBundle) else { return }
              
          let audioPlaybackController = entity.prepareAudio(resource)
          audioPlaybackController.play()
      }
    • 31:02 - Terrain material transition using the slider

      @State private var sliderValue: Float = 0.0
      
      Slider(value: $sliderValue, in: (0.0)...(1.0))
          .onChange(of: sliderValue) { _, _ in
              guard let terrain = rootEntity.findEntity(named: "DioramaTerrain"),
                      var modelComponent = terrain.components[ModelComponent.self],
                      var shaderGraphMaterial = modelComponent.materials.first 
                          as? ShaderGraphMaterial else { return }
              do {
                  try shaderGraphMaterial.setParameter(name: "Progress", value: .float(sliderValue))
                  modelComponent.materials = [shaderGraphMaterial]
                  terrain.components.set(modelComponent)
              } catch { }
          }
      }
    • 31:57 - Audio transition using the slider

      @State private var sliderValue: Float = 0.0
      static let audioQuery = EntityQuery(where: .has(RegionSpecificComponent.self) 
                                          && .has(AmbientAudioComponent.self))
      
      Slider(value: $sliderValue, in: (0.0)...(1.0))
          .onChange(of: sliderValue) { _, _ in
              // ... Change the terrain material property ...
                                      
              rootEntity?.scene?.performQuery(Self.audioQuery).forEach({ audioEmitter in
                  guard var audioComponent = audioEmitter.components[AmbientAudioComponent.self],
                        let regionComponent = audioEmitter.components[RegionSpecificComponent.self]
                  else { return }
      
                  let gain = regionComponent.region.gain(forSliderValue: sliderValue)
                  audioComponent.gain = gain
                  audioEmitter.components.set(audioComponent)
              })
          }
      }

Developer Footer

  • Vídeos
  • WWDC23
  • Work with Reality Composer Pro content in Xcode
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • 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 Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines