Post

Replies

Boosts

Views

Activity

Reply to NSDocumentController not adding "Open Recent" menu
If I manually create the Open Recent menu and add the item for the 'Clear Menu' it properly reflects the state of the list (which isn't appearing). If I clear it, the 'Clear Menu' button becomes disabled automatically - so the NSDocumentController is correctly finding the menu items, but it isn't populating the list.
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’25
Reply to NSDocumentController not adding "Open Recent" menu
I have a done a bit more diagnosis. The "Insert failed..." error in the previous message is caused when it tries to add a recent document that is mirrored in iCloud. If I use a file from a directory not mapped to iCloud I do not get the error, and the file appears in the dock's recent items. I still cannot get the File "Open Recent" menu to populate. I am using XCode 16.2 on OSX 15.3.2
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’25
Reply to NSDocumentController not adding "Open Recent" menu
Interestingly, the recently opened documents are appearing in the dock icon when I right-click (automatically) - and I can successfully open them from there, so I am baffled why the Open Recent menu is not working. edit: I notice though that the recent documents in the dock icon do not update - when I open a document and close it. I see the following error in the console: Insert failed for list identifier com.apple.LSSharedFileList.RecentDocuments Error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (Restricted by sandbox) UserInfo={NSDebugDescription=Restricted by sandbox} but I don't see any sandbox entitlements that control this.
Topic: UI Frameworks SubTopic: AppKit Tags:
Mar ’25
Reply to how do I enable Save As in File menu in SwiftUI?
Thank you for your help! Is there anyway, to have that menu option permanently available? (It is a very common operation in this app, and my original AppKit native version worked this way - this is my first SwiftUI app). The Save panel does not appear when I press Save - it does when I use Save As. It appears to be using "auto save" (I have another ticket asking how to disable this).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to Duplicate toolbar item and wrong document name in SwiftUI document based app
It is still broken running a SwiftUI app on OSX 15.7.2 developed using XCode 26.1
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to NSDocumentController not adding "Open Recent" menu
Thank you Ziqiao. One note for others, the open menu item cannot have a target set, like NSDocumentController.shared, or it won't work. Trying to set this up in applicationDidFinishLaunching was also incorrect.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to how to make certain undo registrations not mark the document as edited
I was able to solve this by overriding NSDocument override func updateChangeCount(_ change: NSDocument.ChangeType) { if change.rawValue & NSDocument.ChangeType.changeDiscardable.rawValue != 0 { return } super.updateChangeCount(change) }
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
Mar ’25
Reply to NSDocumentController not adding "Open Recent" menu
If I manually create the Open Recent menu and add the item for the 'Clear Menu' it properly reflects the state of the list (which isn't appearing). If I clear it, the 'Clear Menu' button becomes disabled automatically - so the NSDocumentController is correctly finding the menu items, but it isn't populating the list.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to NSDocumentController not adding "Open Recent" menu
I have a done a bit more diagnosis. The "Insert failed..." error in the previous message is caused when it tries to add a recent document that is mirrored in iCloud. If I use a file from a directory not mapped to iCloud I do not get the error, and the file appears in the dock's recent items. I still cannot get the File "Open Recent" menu to populate. I am using XCode 16.2 on OSX 15.3.2
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to NSDocumentController not adding "Open Recent" menu
Interestingly, the recently opened documents are appearing in the dock icon when I right-click (automatically) - and I can successfully open them from there, so I am baffled why the Open Recent menu is not working. edit: I notice though that the recent documents in the dock icon do not update - when I open a document and close it. I see the following error in the console: Insert failed for list identifier com.apple.LSSharedFileList.RecentDocuments Error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (Restricted by sandbox) UserInfo={NSDebugDescription=Restricted by sandbox} but I don't see any sandbox entitlements that control this.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to How to disable auto-save in SwiftUI document based app?
I needed to move to an NSDocument based solution to make all of this work.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Any way to change the UI for browse previous versions?
a SwiftUI FileDocument doesn't expose the 'isBrowsingVersions' so the previous answer was the best I could manage. I had too many problems with SwiftUI DoucmentGroup that I needed to move to using a NSDocument based system.
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to SwiftUI revert to saved loads document multiple times
So I compiled the app using the latest XCode, now when I run it, even on older OSX versions, it works as expected. This means that developing with SwiftUI, the behavior you get isn't tied to the OSX, it's tied to the compiler !!! That is unexpected, and honestly, kind of unbelievable.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Any way to change the UI for browse previous versions?
The ScenePhase only seems to update on the last document opened, so it doesn't work properly. The only way I could make this work was by checking if the url passed in contains "com.apple.documentVersions". Kind of a hack, but it is the only thing that seemed to work reliably. Hopefully someone else has a better solution.
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Any way to change the UI for browse previous versions?
Not sure if this is correct, but the browse previous versions has the scene phase as background, and I can inspect this and create an alternate UI.
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to _dispatch_client_callout crash
Sorry Apple for my delay in responding. I did not have notifications turned on. I do not have any 3rd party crash library in use - and certainly not linked. I incorrectly marked the answer as accepted. This is still an issue I'd like to understand.
Replies
Boosts
Views
Activity
Mar ’25
Reply to how do I enable Save As in File menu in SwiftUI?
Understood. I see the same behavior with Pages. I guess I'll need to add an 'Export To' instead. Thanks for your help.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to how do I enable Save As in File menu in SwiftUI?
Thank you for your help! Is there anyway, to have that menu option permanently available? (It is a very common operation in this app, and my original AppKit native version worked this way - this is my first SwiftUI app). The Save panel does not appear when I press Save - it does when I use Save As. It appears to be using "auto save" (I have another ticket asking how to disable this).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to SwiftUI FileDocument: Modify the default save dialog
Did you every figure this out? Apple support is painful - I guess the only way to get a response is to file developer bug tickets.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’25