Swift FileManager.default.copyItem(at: URL, to: URL) folder permission error

I'm working on creating a tiny app that copies a random sampling of files from a source folder to a destination folder: https://github.com/belovachap/Select-Random-Files-Mac

I choose folders in my user's Documents folder, am able to get the random sampling of files but then run into permission errors when trying to copy to the destination folder.

I've tried adding a call to startAccessingSecurityScopedResource on the destination URL but it doesn't seem to help.

Is this having the same problems on anyone else's computer??

Answered by belovachap in 793643022

Reddit helped find the answer for me: https://www.reddit.com/r/swift/comments/1dt1izr/comment/lb6nyqd/

Accepted Answer

Reddit helped find the answer for me: https://www.reddit.com/r/swift/comments/1dt1izr/comment/lb6nyqd/

Swift FileManager.default.copyItem(at: URL, to: URL) folder permission error
 
 
Q