This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex_bi_series-sherpa-onnx/ios-swiftui/SherpaOnnxSubtitle/SherpaOnnxSubtitle/Models/Document.swift
2023-09-25 16:36:16 +08:00

33 lines
732 B
Swift

//
// Document.swift
// YPlayer
//
// Created by knight on 2023/6/5.
//
import SwiftUI
import UniformTypeIdentifiers
struct Document: FileDocument {
static var readableContentTypes = [UTType.srt]
static var writableContentTypes = [UTType.srt]
var data: Data?
init(data: Data?) {
self.data = data
}
init(configuration: ReadConfiguration) throws {
if let data = configuration.file.regularFileContents {
self.data = data
}
}
func fileWrapper(configuration _: WriteConfiguration) throws -> FileWrapper {
guard let data = data else {
throw ExportError.fileNotFound
}
return FileWrapper(regularFileWithContents: data)
}
}