Post

Replies

Boosts

Views

Activity

How can I prevent a document-based swiftUI app from saving files?
I implemented the DocumentGroup as follows DocumentGroup(viewing: MyDoc.self) { file in       ContentView(document: file.$document)       } The documentation - https://developer.apple.com/documentation/swiftui/documentgroup says that this should allow viewing, not editing. > init(viewing: Document.Type, viewer: (FileDocumentConfiguration<Document>) -> Content) Creates a document group that is able to view file documents. Available when Document conforms to FileDocument and Content conforms to View. However if I press Cmd+S or click File > Save the ability to save documents still appears to be there. How can I prevent this? I already set "User Selected File" to Read-Only under Signing and Capabilities in Xcode. Have I missed a step somewhere? I've added a link to a sample project demonstrating the issue. It can open any plain text file with the .txt extension and can save changes to those files. Sample Project - https://github.com/conorgriffin/MyDoc TBH this seems like a bug that the app does not honour the File Access settings
5
2
2.4k
Nov ’20