Created
August 3, 2023 15:16
-
-
Save drosenstark/c50932b4831bb45a7ed274744a2d28d5 to your computer and use it in GitHub Desktop.
Open the directory housing a document in the Files app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thanks to this thing! | |
// https://www.macstories.net/ios/fs-bookmarks-a-shortcut-to-reopen-files-and-folders-directly-in-the-files-app/ | |
extension URL { | |
func openParentDirectoryInFilesApp() { | |
guard var components = URLComponents(url: self.deletingLastPathComponent(), resolvingAgainstBaseURL: false) else { return } | |
components.scheme = "shareddocuments" | |
guard let newURL = components.url else { return } | |
if UIApplication.shared.canOpenURL(newURL) { | |
UIApplication.shared.open(newURL) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment