Reimond Hill
Reimond Hill

Reputation: 4760

Creating hidden/private directories FileManager Swift

My app needs to have a hidden/private(if possible) folder for storing audio files that the app generates itself. This audio files are used to build Database where only the App can populate and delete if needed.

The only activity that the user is able to do is exporting some of this file in a folder called "exported" into either the share folder or the iCloud.

The question is, how do I create this hidden/private folder where a User has no permissions?

Upvotes: 5

Views: 3140

Answers (1)

Reimond Hill
Reimond Hill

Reputation: 4760

lazy var documentsUrl:URL = { return fileManager.urls(for: .documentDirectory, in: .userDomainMask).first! }()
lazy var appInternalMusic:URL = { documentsUrl.appendingPathComponent(".InternalFolder") }()  
try! fileManager.createDirectory(at: appInternalMusic, withIntermediateDirectories: true, attributes: nil)

Upvotes: 3

Related Questions