Posts

Post not yet marked as solved
0 Replies
185 Views
I am currently experiencing strange behavior when determining icons for files. When I determine icons using let icon = NSWorkspace.shared.icon(forFile: path) it generally works fine. However, for some files, a "denied" symbol appears as an overlay. When I look at the corresponding icon in the debugger, a Decorated-Icon with the decoration "com.apple.icon-decoration.system.unsupported" is determined. In Finder, Dock, or other programs, the symbol is displayed correctly. In the case mentioned, it is a website that has been converted into an app using the "Unite" application. Why is NSWorkspace.shared.icon(forFile: path) determining this overlay and is there a way to get the "normal" icon?
Posted
by gkoeder.
Last updated
.
Post not yet marked as solved
1 Replies
798 Views
Hello all, I am trying to use quickLookPreview in SwiftUI (macOS) to view a file using quicklook. The following sample code is actually very simple: import SwiftUI import QuickLook struct ContentView: View {     @State var qlURL: URL?     var body: some View {         Button("Show QuickLook") {             qlURL = URL.init(fileURLWithPath: "path to a file")         }         .quickLookPreview($qlURL)     } } At first glance, everything looks great and the specified file is displayed via quicklook. However, I get numerous error messages in the log: 2023-03-10 14:46:58.258051+0100 SwiftUI-Test1[998:5878590] [General] -[QLPreviewPanel setDelegate:] called while the panel has no controller - Fix this or this will raise soon. See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:. 2023-03-10 14:46:58.258228+0100 SwiftUI-Test1[998:5878590] [General] -[QLPreviewPanel setDataSource:] called while the panel has no controller - Fix this or this will raise soon. See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:. 2023-03-10 14:46:58.261948+0100 SwiftUI-Test1[998:5878590] [General] -[QLPreviewPanel reloadData] called while the panel has no controller - Fix this or this will raise soon. See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:. I'm admittedly a bit lost - how are these messages to be understood and how can they be fixed. Xcode 14.2, macOS 13.2, Target: macOS Thanks! Gerald
Posted
by gkoeder.
Last updated
.
Post marked as solved
1 Replies
540 Views
Does an NSOutlineView have built-in autoscrolling when the mouse is moved to the beginning or end of the NSOutlineView during a drag operation? As plan B I would create a tracking area at the top and bottom and trigger the scrolling while the mouse is over it - but a built-in solution would make more sense if available. Can someone give me a hint here? Thanks!
Posted
by gkoeder.
Last updated
.
Post not yet marked as solved
0 Replies
559 Views
Using Spotlight, the currently available shortcuts of the Shortcuts app can be displayed and opened/started under macOS 12. Since I would like to display a list of available shortcuts in my application, I wonder how this could be realized. Using NSMetadataQuery and the corresponding NSPredicate Spotlight can be accessed and searched. Files, directories and various other information can be requested from Spotlight this way, but I can't find a suitable search filter to give me the available shortcuts. Does anyone here have any ideas?
Posted
by gkoeder.
Last updated
.
Post not yet marked as solved
0 Replies
513 Views
I'm trying to fade in a popover on the docktile of my app. The whole thing should work like this: when a user clicks on the Dock icon, a popover appears above the Dock icon. The DockTile that belongs to the app is determined with NSApplication.shared.dockTile and I can also catch the click on the DockTile with applicationShouldHandleReopen. The view needed to display a popup is an NSImage which represents the ContentView of the DockTile.import Cocoa import Foundation let applicationDelegate = NSApplication.shared.delegate as! AppDelegate @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { let appDockTile = NSApplication.shared.dockTile let popover = NSPopover() func applicationDidFinishLaunching(_ aNotification: Notification) { let dockIcon = NSImage(named: "AppIcon") appDockTile.contentView = NSImageView(image: dockIcon!) appDockTile.display() popover.behavior = .transient popover.resignFirstResponder() } func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { popover.show(relativeTo: appDockTile.contentView!.bounds, of: appDockTile.contentView!, preferredEdge: NSRectEdge.minY) return false } }However, the NSPopover is not displayed and raizes always the following error message:[NSPopover showRelativeToRect:ofView:preferredEdge:]: view has no window. You must supply a view in a window.A popup can apparently only be displayed with reference to a view on a NSWindow. This would also be understandable if an NSPopover could not be displayed without problems at an NSStatusBarButton - and similar to a DockTile there is nothing to be seen of an NSWindow.Does anyone have an idea or tip on how to display a popover to a DockTile or is that really not possible?
Posted
by gkoeder.
Last updated
.