How can I autosave and retrieve images? (Mac app)

How can I autosave and retrieve the images added by drag and drop? I want the images to return when I reopen the app. What codes do I need and where do I put them?

https://developer.apple.com/documentation/appkit/nscollectionviewdelegate/supporting_collection_view_drag_and_drop_through_file_promises
How can I autosave and retrieve images? (Mac app)
 
 
Q