Initial commit for first version of project
This commit is contained in:
20
GasTankAR/Views/TankAR/WorldMapArchiver.swift
Normal file
20
GasTankAR/Views/TankAR/WorldMapArchiver.swift
Normal file
@ -0,0 +1,20 @@
|
||||
//
|
||||
// WorldMapArchiver.swift
|
||||
// GasTankAR
|
||||
//
|
||||
// Created by Dennis Nemec on 26.08.26.
|
||||
//
|
||||
|
||||
import ARKit
|
||||
|
||||
/// Kapselt das (De-)Serialisieren einer `ARWorldMap` via `NSKeyedArchiver`.
|
||||
/// Bewusst thread-neutral gehalten – das Archivieren sollte off-main erfolgen (teuer).
|
||||
enum WorldMapArchiver {
|
||||
static func archive(_ worldMap: ARWorldMap) -> Data? {
|
||||
try? NSKeyedArchiver.archivedData(withRootObject: worldMap, requiringSecureCoding: true)
|
||||
}
|
||||
|
||||
static func unarchive(_ data: Data) -> ARWorldMap? {
|
||||
try? NSKeyedUnarchiver.unarchivedObject(ofClass: ARWorldMap.self, from: data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user