Home Find The Documents Directory
Post
Cancel

Find The Documents Directory

On iOS, apps have their own data storage space that is not accessible by other apps. This space is organized into four directories.

  1. Documents
  2. Library
  3. SystemData
  4. tmp

The most commonly used directory here to story application documents is β€œDocuments”. You can access the path:

1
(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true) as [String]).first

If you want URL then:

1
try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)

This code is required almost in all iOS applications. Here is a code snippet link.

This post is licensed under CC BY 4.0 by the author.