diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj
index cf943d7..0f1d185 100644
--- a/AutoCat.xcodeproj/project.pbxproj
+++ b/AutoCat.xcodeproj/project.pbxproj
@@ -1080,7 +1080,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 97;
+ CURRENT_PROJECT_VERSION = 100;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
@@ -1105,7 +1105,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 97;
+ CURRENT_PROJECT_VERSION = 100;
DEVELOPMENT_TEAM = 46DTTB8X4S;
INFOPLIST_FILE = AutoCat/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
diff --git a/AutoCat/AutoCat.entitlements b/AutoCat/AutoCat.entitlements
index 144ad51..5483679 100644
--- a/AutoCat/AutoCat.entitlements
+++ b/AutoCat/AutoCat.entitlements
@@ -10,6 +10,8 @@
com.apple.security.device.audio-input
+ com.apple.security.files.user-selected.read-write
+
com.apple.security.network.client
com.apple.security.personal-information.location
diff --git a/AutoCat/Controllers/SearchController.swift b/AutoCat/Controllers/SearchController.swift
index 7b6db12..809a6b2 100644
--- a/AutoCat/Controllers/SearchController.swift
+++ b/AutoCat/Controllers/SearchController.swift
@@ -209,8 +209,11 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
do {
let tmpUrl = FileManager.default.tmpUrl(name: "search", ext: "csv")
try csvString.write(to: tmpUrl, atomically: true, encoding: .utf8)
- let activityController = UIActivityViewController(activityItems: [tmpUrl], applicationActivities: nil)
- self.present(activityController, animated: true)
+ #if targetEnvironment(macCatalyst)
+ self.save(file: tmpUrl)
+ #else
+ self.share(file: tmpUrl)
+ #endif
} catch {
HUD.show(error: error)
}
@@ -221,6 +224,21 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
.disposed(by: bag)
}
+ func share(file url: URL) {
+ let activityController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
+ self.present(activityController, animated: true)
+ }
+
+ func save(file url: URL) {
+ if #available(iOS 14, *) {
+ let controller = UIDocumentPickerViewController(forExporting: [url])
+ self.present(controller, animated: true)
+ } else {
+ let controller = UIDocumentPickerViewController(url: url, in: .exportToService)
+ present(controller, animated: true)
+ }
+ }
+
// MARK: - UITableViewDelegate
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {