aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Utility/TextDocument.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-11-27 23:38:04 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-11-27 23:38:04 +0100
commit213710bf5bd6413c747bf126db50816ef5de5a6e (patch)
tree912f8cf87955a08077c92fea8ad934f50b7ab975 /Hotline/Utility/TextDocument.swift
parentf466b21dc02f78c984ba6748e703f6780a7a0db4 (diff)
parent6a95b53616a4abfa306ddce43151cf4fefbd20ed (diff)
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'Hotline/Utility/TextDocument.swift')
-rw-r--r--Hotline/Utility/TextDocument.swift31
1 files changed, 0 insertions, 31 deletions
diff --git a/Hotline/Utility/TextDocument.swift b/Hotline/Utility/TextDocument.swift
deleted file mode 100644
index a3591fd..0000000
--- a/Hotline/Utility/TextDocument.swift
+++ /dev/null
@@ -1,31 +0,0 @@
-import Foundation
-import SwiftUI
-import UniformTypeIdentifiers
-
-struct TextFile: FileDocument {
- // tell the system we support only plain text
- static var readableContentTypes = [UTType.plainText, UTType.utf8PlainText]
-
- // by default our document is empty
- var text = ""
-
- // a simple initializer that creates new, empty documents
- init(initialText: String = "") {
- text = initialText
- }
-
- // this initializer loads data that has been saved previously
- init(configuration: ReadConfiguration) throws {
-
- if let data = configuration.file.regularFileContents {
- if let str = String(data: data, encoding: .utf8) {
- self.text = str
- }
- }
- }
-
- // this will be called when the system wants to write our data to disk
- func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
- return FileWrapper(regularFileWithContents: self.text.data(using: .utf8)!)
- }
-}