Files
Gas-Tank-AR-App/GasTankAR/Views/TankAR/ARViewContainer.swift
2026-09-02 20:54:36 +02:00

30 lines
776 B
Swift

//
// ARViewContainer.swift
// GasTankAR
//
// Created by Dennis Nemec on 26.08.26.
//
import SwiftUI
import RealityKit
/// Dünner UIKit-Adapter: hostet nur die `ARView` und übergibt sie an den Controller.
/// Enthält bewusst keine Logik.
struct ARViewContainer: UIViewRepresentable {
let controller: ARSessionController
func makeCoordinator() -> ARSessionController { controller }
func makeUIView(context: Context) -> ARView {
let view = ARView(frame: .zero)
context.coordinator.attach(to: view)
return view
}
func updateUIView(_ uiView: ARView, context: Context) {}
static func dismantleUIView(_ uiView: ARView, coordinator: ARSessionController) {
MainActor.assumeIsolated { coordinator.detach() }
}
}