Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1234567891011121314151617import SwiftUIimport UniformTypeIdentifiers
struct NotebookDocument: FileDocument { static var readableContentTypes: [UTType] { [.json] } var text: String init(text: String) { self.text = text } init(configuration: ReadConfiguration) throws { guard let data = configuration.file.regularFileContents, data.count <= 8 * 1024 * 1024, let text = String(data: data, encoding: .utf8) else { throw CocoaError(.fileReadCorruptFile) } self.text = text } func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper { FileWrapper(regularFileWithContents: Data(text.utf8)) }}