How do I get the temp directory in iOS using Swift? I use this code, but I get the following error:
let localTempURL: URL = try defaultFileManager.url(for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
The operation couldn’t be completed. (Foundation._GenericObjCError error 0.)
I found this post, but it's old non-preferred way. I would like to be able to get the temp directory using FileManager.url(for:in:appropriateFor:create:).