Saving file to disk in catalyst version
This commit is contained in:
parent
07f3d285d4
commit
512a50b217
@ -1080,7 +1080,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 97;
|
CURRENT_PROJECT_VERSION = 100;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
@ -1105,7 +1105,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 97;
|
CURRENT_PROJECT_VERSION = 100;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
|
|||||||
@ -10,6 +10,8 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.device.audio-input</key>
|
<key>com.apple.security.device.audio-input</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.files.user-selected.read-write</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.personal-information.location</key>
|
<key>com.apple.security.personal-information.location</key>
|
||||||
|
|||||||
@ -209,8 +209,11 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
do {
|
do {
|
||||||
let tmpUrl = FileManager.default.tmpUrl(name: "search", ext: "csv")
|
let tmpUrl = FileManager.default.tmpUrl(name: "search", ext: "csv")
|
||||||
try csvString.write(to: tmpUrl, atomically: true, encoding: .utf8)
|
try csvString.write(to: tmpUrl, atomically: true, encoding: .utf8)
|
||||||
let activityController = UIActivityViewController(activityItems: [tmpUrl], applicationActivities: nil)
|
#if targetEnvironment(macCatalyst)
|
||||||
self.present(activityController, animated: true)
|
self.save(file: tmpUrl)
|
||||||
|
#else
|
||||||
|
self.share(file: tmpUrl)
|
||||||
|
#endif
|
||||||
} catch {
|
} catch {
|
||||||
HUD.show(error: error)
|
HUD.show(error: error)
|
||||||
}
|
}
|
||||||
@ -221,6 +224,21 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
.disposed(by: bag)
|
.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
|
// MARK: - UITableViewDelegate
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user