feat: optimize reader caching and document formats

This commit is contained in:
shenlei
2026-07-20 17:22:06 +09:00
parent 52f803e8db
commit 68d9363f0a
35 changed files with 3771 additions and 2229 deletions
@@ -0,0 +1,21 @@
import Foundation
/// File formats that can be opened by `RDEpubURLReaderController`.
public enum RDReaderDocumentFormat: String, CaseIterable, Sendable {
case epub
case plainText = "txt"
case mobi
case cbz
public init?(fileURL: URL) {
self.init(rawValue: fileURL.pathExtension.lowercased())
}
public static func supports(_ fileURL: URL) -> Bool {
RDReaderDocumentFormat(fileURL: fileURL) != nil
}
public static var supportedPathExtensions: Set<String> {
Set(allCases.map(\.rawValue))
}
}