diff options
Diffstat (limited to 'DomainDig/ExportPresenter.swift')
| -rw-r--r-- | DomainDig/ExportPresenter.swift | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/DomainDig/ExportPresenter.swift b/DomainDig/ExportPresenter.swift index 82ec7ae..2dbd1fc 100644 --- a/DomainDig/ExportPresenter.swift +++ b/DomainDig/ExportPresenter.swift @@ -3,10 +3,14 @@ import UIKit enum ExportPresenter { static func share(filename: String, contents: String) { + share(filename: filename, data: Data(contents.utf8)) + } + + static func share(filename: String, data: Data) { let url = FileManager.default.temporaryDirectory.appendingPathComponent(filename) do { - try contents.write(to: url, atomically: true, encoding: .utf8) + try data.write(to: url, options: .atomic) } catch { return } |
