1 min readAug 19, 2020
Thanks for the great article!
I fixed some bugs, and put the new version in this Gist.
Note: this version is only for picking files, not folders.
Fixed bugs:
- inside
switch sourceType
→case .files
, you want to usefolderURL
instead ofpickedURL
to make the document. According to the documentation, “Always use the URL passed into the block instead of the value in the url parameter.” - inside
documentFromURL(pickedURL:)
, missing}
underneathpickedURL.stopAccessingSecurityScopedResource()
.