Lab 061 – First look at SwiftUI animations in RealityKit
Using the new content.animate method to apply a SwiftUI animation to a RealityKit entity.
I saw this awesome addition in the WWDC session called Better together: SwiftUI and RealityKit. SwiftUI has some awesome animations built in and now we can use them with our RealityKit entities. I’ll create some more details example code in the future. Today I’m just taking a peak at how this can work. I’m using RealityViewContent.animate for this, but there is also an Entity.animate variant.
When we activate the toggle, we’ll animate a value using .easeInOut with a 2 second duration. Notice that the toggle visual effects and the entity animation are synchronized. Features like this can do a lot to make RealityKit content blend into 2D spatial UI.
struct Lab061: View {
@State private var subject = Entity()
@State private var subjectToggle = false
// See "Better together: SwiftUI and RealityKit" WWDC 2025
var animatedIsOffset: Binding<Bool> {
$subjectToggle
.animation(.easeInOut(duration: 2))
}
var body: some View {
RealityView { content in
guard let scene = try? await Entity(named: "SwiftUIAnimationLab", in: realityKitContentBundle) else { return }
content.add(scene)
if let subject = scene.findEntity(named: "Subject") {
self.subject = subject
}
} update: { content in
// Using content.animate here, but there is also an Entity animate I need to check out
content.animate {
let scaler: Float = subjectToggle ? 2.0 : 1.0
subject.scale = .init(repeating: scaler)
}
}
.toolbar {
ToolbarItem(placement: .bottomOrnament, content: {
Toggle(isOn: animatedIsOffset, label: {
Text("Toggle Subject")
})
})
}
}
}Note: We can’t animate just any value on any component with this method. Apple shared a list of supported components in the session. It is mostly component that use numbers for common values. For example, opacity, intensity on lights, audio volume, etc.
Support our work so we can continue to bring you new examples and articles.
Download the Xcode project with this and many more labs from Step Into Vision.

Follow Step Into Vision