Don't show directories in recent documents

This commit is contained in:
Arkadiusz Fal 2022-11-19 14:52:08 +01:00
parent 5ded159dec
commit 8d53d7fe79

View File

@ -59,6 +59,7 @@ final class DocumentsModel: ObservableObject {
return Array( return Array(
contents(of: documentsDirectory) contents(of: documentsDirectory)
.filter { !isDirectory($0) }
.sorted { .sorted {
((try? $0.resourceValues(forKeys: [.creationDateKey]).creationDate) ?? Date()) > ((try? $0.resourceValues(forKeys: [.creationDateKey]).creationDate) ?? Date()) >
((try? $1.resourceValues(forKeys: [.creationDateKey]).creationDate) ?? Date()) ((try? $1.resourceValues(forKeys: [.creationDateKey]).creationDate) ?? Date())