feat: optimize reader caching and document formats
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user