realityViewLayoutBehavior(_:)
A view modifier that controls the frame sizing and content alignment behavior for RealityView
Declaration
@MainActor @preconcurrency func realityViewLayoutBehavior(_ layoutOption: RealityViewLayoutOption) -> some View
Discussion
This modifier is only accounted for after the end of the make closure. It isn’t checked on any calls to the update closure.
struct ModelWrapperView: View {
let modelName: String
var body: some View {
RealityView { content in
let model = try? await Entity(named: modelName)
if let model {
content.add(model)
}
}
.realityViewLayoutBehavior(.fixedSize)
}
}See RealityViewLayoutOption for a list of options to pass into realityViewLayoutBehavior(_:).