Crashlog-0916-071225.log
I have an app that crashes on OSX 26 only. I have a @StateObject which is an observer of the NSColorPanel.
When I call
let panel = NSColorPanel.shared
in init(), SwiftUI will crash - apparently with an update while view is being updated. See crash log.
I was able to work around it by adding
let _ = NSColorPanel.shared
in my AppDelegate before SwiftUI is initialized.
The exact code worked fine in all previous OSX versions.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have a SwiftUI based app. For lots of reasons I was forced to use NSDocument instead of using DocumentGroup.
I configure the main menu in my AppDelegate.
It has the following code:
let fileMenuItem = NSMenuItem()
let fileMenu = NSMenu(title: "File")
fileMenu.addItem(withTitle: "New", action: #selector(NSDocumentController.newDocument(_:)), keyEquivalent: "n")
fileMenu.addItem(withTitle: "Open...", action: #selector(NSDocumentController.openDocument(_:)), keyEquivalent: "o")
The New and Open work as expected.
It is my understanding that the NSDocumentController should automatically add the "Open Recent" menu when it sees the Open action based on the NSDocumentController.
It is not appearing.
When I print the state of the recent documents using
print("recent documents \(NSDocumentController.shared.recentDocumentURLs), maximum \(NSDocumentController.shared.maximumRecentDocumentCount)")
I see the recent document urls and a count of 10.
What can I do to make the menu appear?
Thanks for the help.
Hi. I thought the purpose of UndoManager.setActionIsDiscardable() was for this purpose - but the document still shows as edited.
These changes like changing the zoom/viewing area should not cause the document to be considered edited - but you'd still like to be able to undo them.
The documentation here https://developer.apple.com/documentation/foundation/undomanager/1415261-undoactionisdiscardable?changes=_6 even describes using it for just this purpose.
If this isn't the method, how can I do this? Thanks.
Topic:
UI Frameworks
SubTopic:
AppKit
My app typically works with very large image files. Having it auto-save on every change is very expensive as most formats cannot be saved incrementally.
Is there a way to disable this and force the user to use the Save menu item on OSX, and possibly a Save button on iOS?
My UI is very heavyweight, so I'd like to show the previous versions using a lighter weight - almost like quick look - UI.
This would also allow me to 'zoom to fit' so the entire document can be seen.
I am using SwiftUI, but I wouldn't mind jumping into AppKit and/or UIKit to implement this.
Using, the standard Apple example at https://developer.apple.com/documentation/swiftui/building-a-document-based-app-with-swiftui
I only made a small change to print when reading a file, with the time.
When you use 'revert to saved', it writes the current version (expected), then loads the saved version (expected), then a few seconds later (not moving the mouse, edits, etc.) it reloads the document again. Then if you click away from the window, it loads it yet again - four times!
This loading of the document twice breaks apps where the loading may take longer (large documents), then the document is replaced while the user has already started editing the recently loaded document.
This is a really bad bug. Any ideas?
Here is the added logs:
reading file! testfile.story at 2025-03-11 20:35:16 +0000
saving file! testfile.story at 2025-03-11 20:35:27 +0000
reading file! testfile.story at 2025-03-11 20:35:27 +0000
reading file! testfile.story at 2025-03-11 20:35:30 +0000
reading file! testfile.story at 2025-03-11 20:35:31 +0000
I see the same behavior with 'Revert To Last Opened'. It seems to work as expected when you browse all versions and pick a specific version.
I received the attached crash report. The problem is that the crash report does not contain the abort reason - it appears to be thrown in the GCD library with no additional information.
Is it a possible deadlock?
2023-02-15_02-40-23.0077_+0100-94015bd052c4005658221a5e6279f28a75b9e92c.crash
Any ideas?
The documentation here states that the saveItem command group placement contains the Save As as a default command, but it doesn't appear.
I have my document type specifying multiple 'writableContentTypes' - I expected this would enable the save as.
How do I do this?
Hi,
I am developing a new SwiftUI app. Running under OSX, I see very high cpu usage (I am generating lots of gpu based updates which shouldn't affect the cpu).
I have used the profiler to ensure my swift property updates are minimal, yet the cpu usage is high coming from SwiftUI.
It seems the high cpu usage is coming from NSAppearance, specifically, CUICopyMeasurements - for a single button??? But the swift updates don't show any buttons being updating
Topic:
UI Frameworks
SubTopic:
SwiftUI
As the developer of Seashore, using
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationNone];
no longer works as expected in Big Sur on a Retina display. The exact build works fine in Catalina.
Small images seem to be first scaled using Medium or High interpolation to 2x, then scaled use 'None' to the desired size - causing blurriness.
This the code to display and scale the image:
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationNone];
[image drawInRect:alignedRect fromRect:copy operation:NSCompositeSourceOver fraction:1.0 respectFlipped:TRUE hints:NULL];
Any ideas for a fix?