If you just want to open the Files
app then use following code:
guard let urlForFilesApp = URL(string: "shareddocuments://"), UIApplication.shared.canOpenURL(urlForFilesApp) else{return}
UIApplication.shared.open(urlForFilesApp, options: [:])
And if you want to open your app's directory/folder named same as your App's name
in the Files
app then following code will work:
guard let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first, let appFolderURL = URL(string: "shareddocuments://\(documentsURL.path)")else{return}
guard UIApplication.shared.canOpenURL(appFolderURL) else{return}
UIApplication.shared.open(appFolderURL, options: [:])
Reference here->