On iOS, apps have their own data storage space that is not accessible by other apps. This space is organized into four directories.
- Documents
- Library
- SystemData
- 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.