Skip to content

Instantly share code, notes, and snippets.

@Tulakshana
Created December 17, 2018 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tulakshana/46ab09e4ddf7fbc661e688578399d9b7 to your computer and use it in GitHub Desktop.
Save Tulakshana/46ab09e4ddf7fbc661e688578399d9b7 to your computer and use it in GitHub Desktop.
A helper function to update the modified date of a file
static func update(modifiedDate: Date, url: URL) {
do {
var values = try url.resourceValues(forKeys: [URLResourceKey.contentModificationDateKey])
values.contentModificationDate = modifiedDate
try url.setResourceValues(values)
} catch {
print(error.localizedDescription)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment