Simplify images, tag overview
This commit is contained in:
@ -103,6 +103,10 @@ enum FileType: String {
|
||||
|
||||
case aac
|
||||
|
||||
case m4b
|
||||
|
||||
case m4a
|
||||
|
||||
// MARK: Other
|
||||
|
||||
case noExtension
|
||||
@ -143,7 +147,7 @@ enum FileType: String {
|
||||
return .image
|
||||
case .mp4, .m4v, .webm:
|
||||
return .video
|
||||
case .mp3, .aac:
|
||||
case .mp3, .aac, .m4b, .m4a:
|
||||
return .audio
|
||||
case .js, .css, .ttf:
|
||||
return .asset
|
||||
@ -160,65 +164,38 @@ enum FileType: String {
|
||||
}
|
||||
}
|
||||
|
||||
var fileExtension: String {
|
||||
var fileExtension: String? {
|
||||
switch self {
|
||||
case .noExtension, .unknown: return ""
|
||||
case .noExtension, .unknown: return nil
|
||||
default:
|
||||
return rawValue
|
||||
}
|
||||
}
|
||||
|
||||
var isImage: Bool {
|
||||
switch self {
|
||||
case .jpg, .png, .avif, .webp, .gif, .svg, .tiff:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
category == .image
|
||||
}
|
||||
|
||||
var isVideo: Bool {
|
||||
switch self {
|
||||
case .mp4, .m4v, .webm:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
category == .video
|
||||
}
|
||||
|
||||
var isAudio: Bool {
|
||||
switch self {
|
||||
case .mp3, .aac:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
category == .audio
|
||||
}
|
||||
|
||||
var isAsset: Bool {
|
||||
switch self {
|
||||
case .js, .css, .ttf:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
category == .asset
|
||||
}
|
||||
|
||||
var isTextFile: Bool {
|
||||
switch self {
|
||||
case .html, .cpp, .swift, .css, .js, .json, .conf, .yaml:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
switch category {
|
||||
case .text, .code: return true
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
var isOtherFile: Bool {
|
||||
switch self {
|
||||
case .noExtension, .zip, .cddx, .pdf, .key, .psd:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
case .css, .js: return true
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user