22 lines
557 B
Swift
22 lines
557 B
Swift
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))
|
|
}
|
|
}
|