Initial commit for first version of project
This commit is contained in:
54
GasTankAR/Views/SettingsView.swift
Normal file
54
GasTankAR/Views/SettingsView.swift
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// SettingsView.swift
|
||||
// GasTankAR
|
||||
//
|
||||
// Created by Dennis Nemec on 26.08.26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import ARKit
|
||||
|
||||
/// Zentraler Schlüssel für die LiDAR-Einstellung (in AppStorage/UserDefaults).
|
||||
enum SettingsKeys {
|
||||
static let lidarFeaturesEnabled = "lidarFeaturesEnabled"
|
||||
}
|
||||
|
||||
struct SettingsView: View {
|
||||
@AppStorage(SettingsKeys.lidarFeaturesEnabled) private var lidarEnabled = false
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
/// LiDAR ist verfügbar, wenn das Gerät Scene-Reconstruction (Mesh) unterstützt.
|
||||
private var lidarSupported: Bool {
|
||||
ARWorldTrackingConfiguration.supportsSceneReconstruction(.mesh)
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
Section {
|
||||
Toggle("LiDAR-Funktionen aktivieren", isOn: $lidarEnabled)
|
||||
.disabled(!lidarSupported)
|
||||
} header: {
|
||||
Text("Augmented Reality")
|
||||
} footer: {
|
||||
if lidarSupported {
|
||||
Text("Nutzt den LiDAR-Scanner für präzisere Flächenerkennung, Tiefe und realistische Verdeckung. Änderungen greifen beim nächsten Start des AR-Modus.")
|
||||
} else {
|
||||
Text("Dieses Gerät hat keinen LiDAR-Scanner. Die App nutzt automatisch das Verfahren ohne LiDAR.")
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle("Einstellungen")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Fertig") { dismiss() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
SettingsView()
|
||||
}
|
||||
Reference in New Issue
Block a user