Additionally, if I use my custom type instead of .json when exporting, the "Save to Files" doesn't even show up, even if I did set the export type in the info.plist file.
extension UTType {
static var car: UTType = UTType(exportedAs: "com.acme.cararchive")
}
extension Car: Transferable {
static var transferRepresentation: some TransferRepresentation {
DataRepresentation(contentType: .car) { archive in
try JSONEncoder().encode(archive)
} importing: { data in
try JSONDecoder().decode(Car.self, from: data)
}
}
}
fefe
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: