RealityKit Basics: RealityViewContent
This structure provides access to entities, subscriptions, animations, and coordinate space conversions.
The most basic RealityView we can create adds a single entity.
struct Example106: View {
var body: some View {
RealityView { content in
let subjectA = createStepDemoBox()
content.add(subjectA)
}
}
}content.add() let’s us add our new entity to the view. But what is content, or more RealityViewContent? This structure enables us to use a handful of important features. We can add, remove, and read data about entities. We can subscribe to events and perform animations. We can also access a variety of convenient coordinate space converters.
Working with Entities
We can add entities
content.add(subjectA)Remove them
content.remove(subjectA)And get a list of all entities in the RealityView.
print(content.entities)struct Example106: View {
var body: some View {
RealityView { content in
// Add two entities
let subjectA = createStepDemoBox()
content.add(subjectA)
let subjectB = createStepDemoBox()
content.add(subjectB)
print(content.entities) // includes both entities
content.remove(subjectA)
print(content.entities) // includes only subjectB
}
}
}Subscribe to Events
RealityViewContent has a number of events we can subscribe to. Some common event sets include ComponentEvents, ManipulationEvents, and CollisionEvents. Reasons to use these vary, but implementation generally looks like this. We call content.subscribe with the event we want. Then we provide a closure with the code to execute when the event fires.
_ = content.subscribe(to: ManipulationEvents.WillBegin.self) { event in
print("picked up \(event.entity.name)")
}We’ll dive deeper into Events in another post.
Animation
New in visionOS 26, we can call SwiftUI animations for entities in our scene.
content.animate {
let scaler: Float = subjectToggle ? 2.0 : 1.0
subjectB.scale = .init(repeating: scaler)
}With completion handler
content.animate(body: {
let scaler: Float = subjectToggle ? 2.0 : 1.0
subjectB.scale = .init(repeating: scaler)
}, completion: {
print("animation done")
})Conversions
Lastly, RealityViewContent has many conversion helpers. We can convert SwiftUI points to RealityView units, conversion from global to local. Convert from bounding boxed to a scaler, etc. We explore these conversions in more detail soon.

For example, we can convert the bounding box of the volume from SwiftUI Points to RealityKit Units.
let newFrame = content.convert(proxy.frame(in: .global), from: .global, to: .scene)
print("volume bounds in scene: \(newFrame.min.x), \(newFrame.min.y), \(newFrame.min.z) - \(newFrame.max.x), \(newFrame.max.y), \(newFrame.max.z)")We’ve only just touched on each of these categories of feature, but we’ll be exploring them further in this series.
Download the Xcode project with this and many more examples from Step Into Vision.
Some examples are provided as standalone Xcode projects. You can find those here.

Follow Step Into Vision