Skip to content

Instantly share code, notes, and snippets.

@delasign
Created October 24, 2024 19:23
Show Gist options
  • Save delasign/66d85daa3535c59be5f6fb1c2c368ecf to your computer and use it in GitHub Desktop.
Save delasign/66d85daa3535c59be5f6fb1c2c368ecf to your computer and use it in GitHub Desktop.
Sample Delete MacOS File functionality
import Foundation
func deleteFileAtLocation(url: URL) {
do {
try FileManager.default.removeItem(at: url)
debugPrint("\(DebuggingIdentifiers.actionOrEventSucceded) deleteFileAtLocation : \(url).")
} catch {
debugPrint("\(DebuggingIdentifiers.actionOrEventFailed) deleteFileAtLocation : \(error)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment