Created
December 17, 2018 17:32
-
-
Save Tulakshana/46ab09e4ddf7fbc661e688578399d9b7 to your computer and use it in GitHub Desktop.
A helper function to update the modified date of a file
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
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