Contents

DebugReplaceableView

Erases view opaque result types in debug builds.

Declaration

struct DebugReplaceableView

Overview

You don’t use this type directly. Instead SwiftUI creates this type on your behalf when building in debug mode.

When in debug builds, SwiftUI will erase all opaque result types to DebugReplaceableView. This allows developer tools, such as Xcode Previews, to replace the definition of the view without fully rebuilding.

As such, seeing this type in traces and the view debugger is expected when building for debugging. This type erasure can impact performance, especially when dealing with dynamic content (like content generated by a ForEach, or List) so any performance testing should be done in release mode.

This type acts similarly to an AnyView in that it type-erases its content, however it depends on the underlying type of the value not actually changing as it is in place of an opaque result type. As such, it should not be used in app code.