0

My app has a custom Document type and create, edit, and save the Documents with custom extension. For saving I serialize the document and write Data to a file URL. For retrieving I use FileManager methods.

I want to save a custom value with File which I don't know how to do. I want to keep the File status as editing or done. When user create a new Document it's default status should be editing and he can make the file as done manually inside the app. I don't allow to edit done files , user can only view them.

Can I use appendOnly: FileAttributeKey for this purpose, assuming to make the file read-only if user marks it as done?

I also found this answer about extend file attributes Write extend file attributes swift example. Is this a recommended way by Apple? If above attribute cannot help I guess I'll have to use extended file attributes.. please advice

Thanks in advance

nmy
  • 488
  • 8
  • 21
  • Try https://developer.apple.com/documentation/foundation/fileattributekey/1414784-immutable – Leo Dabus Nov 06 '20 at 08:29
  • @LeoDabus thanks. But making immutable prevents from deleting the file? I want to delete `done` files too – nmy Nov 06 '20 at 09:22

0 Answers0