Created
March 22, 2019 19:09
-
-
Save bill350/bec88f766841dcddea22a598a1f4030c to your computer and use it in GitHub Desktop.
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
func writeData(_ data: Data?, archiveName: String) { | |
guard let data = data else { | |
return | |
} | |
do { | |
let current = FileManager.default.currentDirectoryPath | |
let url = URL(string: "file://\(current)")! | |
let fileURL = url.appendingPathComponent("\(archiveName).zip") | |
try data.write(to: fileURL) | |
} catch { | |
// Error catching | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment