aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Utility/BookmarkDocument.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2025-11-07 12:44:55 -0800
committerDustin Mierau <dustin@mierau.me>2025-11-07 12:44:55 -0800
commita55318fa8d643160900bec3e6b14e7404c63497a (patch)
treeab6a9eca9a368b35e1490becc70f94ebde6ac271 /Hotline/Utility/BookmarkDocument.swift
parent786a387d58fc66ae20716a9dee46b74dff8e6894 (diff)
Organize Library folder a bit. Update Tracker add/edit sheet design.
Diffstat (limited to 'Hotline/Utility/BookmarkDocument.swift')
-rw-r--r--Hotline/Utility/BookmarkDocument.swift32
1 files changed, 0 insertions, 32 deletions
diff --git a/Hotline/Utility/BookmarkDocument.swift b/Hotline/Utility/BookmarkDocument.swift
deleted file mode 100644
index 47fa442..0000000
--- a/Hotline/Utility/BookmarkDocument.swift
+++ /dev/null
@@ -1,32 +0,0 @@
-import SwiftUI
-import Foundation
-import UniformTypeIdentifiers
-
-struct BookmarkDocument: FileDocument {
- static var readableContentTypes: [UTType] { [.data, UTType(filenameExtension: "hlbm")!] }
- static var writableContentTypes: [UTType] { [.data, UTType(filenameExtension: "hlbm")!] }
-
- var bookmark: Bookmark
-
- init(bookmark: Bookmark) {
- self.bookmark = bookmark
- }
-
- init(configuration: ReadConfiguration) throws {
- guard configuration.file.isRegularFile,
- let data = configuration.file.regularFileContents,
- let fileName = configuration.file.preferredFilename,
- let bookmark = Bookmark(fileData: data, name: (fileName as NSString).deletingPathExtension)
- else {
- throw CocoaError(.fileReadCorruptFile)
- }
- self.bookmark = bookmark
- }
-
- func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
- let wrapper = FileWrapper(regularFileWithContents: self.bookmark.bookmarkFileData()!)
- wrapper.fileAttributes[FileAttributeKey.hfsCreatorCode.rawValue] = "HTLC".fourCharCode()
- wrapper.fileAttributes[FileAttributeKey.hfsTypeCode.rawValue] = "HTbm".fourCharCode()
- return wrapper
- }
-}