Created
August 13, 2018 02:44
-
-
Save nishabe/3f6538db5396bea59b795ee55a46debf to your computer and use it in GitHub Desktop.
SWIFT: Get Documents Directory Path
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
| public extension FileManager { | |
| static var documentsDirectoryURL: URL { | |
| return FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! | |
| } | |
| } | |
| let docUrl = FileManager.documentsDirectoryURL | |
| or | |
| let docUrl = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment