You can use FileManager
to get the file attributes and then retrieve the last accessed date. Here's an example code snippet:
main.swift334 chars10 lines
Note that the attributesOfItem
method throws an error if the file doesn't exist or if a permissions issue is encountered. So, you'll want to make sure to handle those cases appropriately in your code.
gistlibby LogSnag