TIL `FileManager.default.displayName(atPath: url.path)` for displaying name of file/folder to the user
From NSHipster learned:
Long story short, when displaying the name of a file or directory to the user, don’t simply take the last path component. Instead, call the method
displayName(atPath:)
:
// Bad
let filename = directoryURL.pathComponents.last
// Good
let filename = FileManager.default.displayName(atPath: url.path)