Skip to content

Instantly share code, notes, and snippets.

@bill350
Created March 22, 2019 19:09
Show Gist options
  • Save bill350/bec88f766841dcddea22a598a1f4030c to your computer and use it in GitHub Desktop.
Save bill350/bec88f766841dcddea22a598a1f4030c to your computer and use it in GitHub Desktop.
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