Initial commit for first version of project
This commit is contained in:
29
GasTankAR/Views/TankAR/ARViewContainer.swift
Normal file
29
GasTankAR/Views/TankAR/ARViewContainer.swift
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// 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() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user