<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/RealityView",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:19_RealityKit_SwiftUI0A4ViewV"
  },
  "title" : "RealityView"
}
-->

# RealityView

A view that contains RealityKit content.

```
@MainActor @preconcurrency struct RealityView<Content> where Content : View
```

## Overview

Use `RealityView` to display rich 3D RealityKit content in your
app, including content you author in Reality Composer Pro.
`RealityView` passes a structure that conforms to
[`RealityViewContentProtocol`](/documentation/RealityKit/RealityViewContentProtocol) to its `make` and
`update` closures, which you can use to add and remove
RealityKit entities to your view.

Here is a simple example showing how you can display a custom
[`ModelEntity`](/documentation/RealityKit/ModelEntity) using `RealityView`:

```swift
struct ModelExample: View {
    var body: some View {
        RealityView { content in
            if let robot = try? await ModelEntity(named: "robot") {
                content.add(robot)
            }
            Task {
                // Asynchronously perform any additional work to configure
                // the content after the system renders the view.
            }
        }
    }
}
```

Note that the closure in the example above is `async`, and can be used
to load contents from your app’s bundle or from any `URL` in the background.
While your content is loading, `RealityView` will automatically display a
placeholder view, which you can customize using the optional `placeholder`
parameter.

> Tip: Load your content asynchronously to
> avoid introducing a hang in your app.

You can also use the optional `update` closure on your `RealityView` to
update your RealityKit content in response to changes in your view’s state.
`RealityView` displays your RealityKit content inline in true 3D
space, occupying the available space in your app’s 3D bounds.
The [`RealityViewContent`](/documentation/RealityKit/RealityViewContent) type on visionOS,
and [`RealityViewCameraContent`](/documentation/RealityKit/RealityViewCameraContent) on other platforms
represents the content of your `RealityView`.

If you want to run code every frame (to do animations or simulations), you can
use a [`System`](/documentation/RealityKit/System) or directly subscribe to the engine’s `SceneEvents.Update`:

```swift
RealityView { content in
   let entity = ModelEntity(mesh: .generateSphere(radius: 0.1))
   content.add(entity)
   _ = content.subscribe(to: SceneEvents.Update.self) { event in
       entity.position.y -= Float(event.deltaTime)
   }
}
```

`RealityView` has a flexible size by default, and does not size itself based
on the RealityKit content it displays.
For more advanced uses of RealityKit, such as subscribing to RealityKit
events, performing coordinate conversions, or working with AR capabilities,
refer to the [`RealityViewContentProtocol`](/documentation/RealityKit/RealityViewContentProtocol) types.

## Topics

### Creating a reality view for visionOS

[`init(make:update:)`](/documentation/RealityKit/RealityView/init(make:update:)-666xr)

Creates a new reality view for visionOS with
an optional update closure.

[`init(make:update:placeholder:)`](/documentation/RealityKit/RealityView/init(make:update:placeholder:)-4c8yv)

Creates a new reality view for visionOS with
an optional update closure
and placeholder view.

[`init(make:update:attachments:)`](/documentation/RealityKit/RealityView/init(make:update:attachments:))

Creates a reality view for visionOS, with attachments
and an optional update closure.

[`init(make:update:placeholder:attachments:)`](/documentation/RealityKit/RealityView/init(make:update:placeholder:attachments:))

Creates a reality view for visionOS, with attachments,
an optional update closure,
and placeholder view.

### Creating a reality view for iOS and macOS

[`init(make:update:)`](/documentation/RealityKit/RealityView/init(make:update:)-234sv)

Creates a reality view for iOS and macOS, with
an optional update closure.

[`init(make:update:placeholder:)`](/documentation/RealityKit/RealityView/init(make:update:placeholder:)-4x7ds)

Creates a reality view for iOS and macOS, with
an optional update closure
and placeholder view.

### Inspecting the content within a reality view

[`RealityView.DefaultPlaceholder`](/documentation/RealityKit/RealityView/DefaultPlaceholder)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)