Created
May 29, 2020 14:56
-
-
Save umwelt/fb3c50c77b8e0f15a68bb8bed931178b to your computer and use it in GitHub Desktop.
FileManager Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| extension FileManager { | |
| func urls(for directory: FileManager.SearchPathDirectory, skipsHiddenFiles: Bool = true ) -> [URL]? { | |
| let documentsURL = urls(for: directory, in: .userDomainMask)[0] | |
| let fileURLs = try? contentsOfDirectory(at: documentsURL, includingPropertiesForKeys: nil, options: skipsHiddenFiles ? .skipsHiddenFiles : [] ) | |
| return fileURLs | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment