How to use RealityKit Package Content in SceneKit

Explicitly declare the resources in the Package.swift file, import the module and use the code found below.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 01/01/2025 at 11:23
Last Updated on 01/01/2025 at 12:15
<p>Three flowers that represent Swift, RealityKit and XCode side by side. Beneath them sits the text "Reality Kit Content in SceneKit."</p>

Explicitly declare the resources in the Package.swift file, import the module and use the code found below.

Subscribe

The following tutorial reveals code our upcoming app Object Capture Pro. If you wish to be updated on the progress and release of this app, please subscribe using the link below.

Subscribe

This tutorial assumes that you have successfully added a Reality Kit Content to an XCode project. 

If you have not follow the tutorial below.

How to create a new RealityKitContent package for a VisionOS project

Step One: Update the Package

<p>A screenshot of XCode showing the updates that we made to the package.swift file.</p>

Update the Package.swift file within the  Reality Kit Content package to explicitly allow the resources to be available.

This is done by adding a line similar to the one below for each of the files to the resources array found within the .target of the targets.

.process("PACKAGE_NAME.rkassets/FILE_NAME.FILE_EXTENSION")

If you are having issues with this step, please consult the tutorial below to learn how to debug the contents of a package.

How to debug the files that a package makes available to XCode

For more information, consult the Apple Developer documentation linked below.

Apple Developer | Bundling resources with a Swift package

Step Two: Add to SceneKit

<p>A screenshot of XCode showing the code for converting RealityKit Content to a SCNScene.</p>

Using code similar to the one below, use your RealityKit Content within a SCNScene.

Step Three: Test

<p>A screenshot of the file within a sample NSView of Object Capture Pro.</p>

Run the code and confirm everything works.

Looking to learn more about SwiftUI, Swift, Swift Testing, Design and Technology?

Search our blog to learn more about Swift, SwiftUI, Swift Testing, design and technology.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe