39,604 questions
1
vote
0
answers
73
views
Why does NSEvent.addGlobalMonitorForEvents still work in a Sandboxed macOS app
I am building a macOS utility using SwiftUI and Swift that records and displays keyboard shortcuts (like Cmd+C, Cmd+V) in the UI. To achieve this, I am using NSEvent.addGlobalMonitorForEvents(matching:...
3
votes
1
answer
98
views
How to draw tinted monochrome SF Symbol with AppKit
This is super easy with UIKit (imageWithTintColor:) but I need tinted monochrome NSImage in AppKit and no such equivalent exists. I know there is private method in AppKit -[NSImage ...
-1
votes
1
answer
77
views
NSScrollView starts scrolled down instead of showing top content on launch
I created a simple project where an NSScrollView contains a vertical NSStackView with several colored square NSView items.
However, when I build and run the app, it launches already scrolled down by ...
0
votes
0
answers
63
views
How to display SVG using QuickLookUI inside app?
I have old code that is capable of displaying every image but not the SVG. SVG can be displayed with QuickLook using Finder. However, I cannot replicate this in app. Quick note: NSImageView can ...
0
votes
0
answers
223
views
XCode 26.0.1, macOS 15.7, Objective-C/Cocoa UI Bindings issue
The console is filled with:
ViewBridge to RemoteViewService Terminated: Error Domain=com.apple.ViewBridge Code=18 "(null)" UserInfo={com.apple.ViewBridge.error.hint=this process disconnected ...
1
vote
1
answer
103
views
Get a Tk widget's associated CGContext
I've been working on a Tk widget that uses Cairo for more complex drawings as an extension to the standard Tk functions.
I've had great success on Windows and Linux, but not so much on MacOS. I need ...
-1
votes
1
answer
139
views
What is wrong with the following Objective-C/Cocoa book example?
I am learning Objective-C + Cocoa. According to a very outdated book (there are no newer ones like this one), I need to do the following:
Create the application.
Create a new Cocoa application named ...
2
votes
0
answers
90
views
How can I fetch the tinted folder icon in macOS Tahoe using Cocoa?
In Tahoe, folder icons are color-tinted with a gradient. A small part of the folder remains uncolored, and it’s also possible to overlay a mask icon or even an emoji on top of the folder.
How can I ...
0
votes
0
answers
76
views
NSURLAuthenticationMethodClientCertificate not getting fired in URLSession:didReceiveChallenge: for TLS 1.3 but works fine with TLS 1.2
I am trying to authenticate the communication using certificates over TLS 1.3 in Cocoa application, but URLSession:didReceiveChallenge:ComplitionHandler didn't get called for ...
1
vote
1
answer
110
views
How to draw line number with NSRulerView?
How to draw line number with NSRulerView?
Displaying line numbers with NSTextView, written with Objective-C, clean and simple. Sorry, I know this is an old question frequently asked, but I can't find ...
0
votes
0
answers
111
views
NSSavePanel ignores setDirectoryURL: on macOS Sequoia (15), always opens at last-used location
I have code in my macOS app that shows a save dialog using NSSavePanel.
I want the panel to always open in a specific directory that I send as a parameter to my function. (e.g., /User/Desktop).
Here’s ...
0
votes
0
answers
95
views
macOS Cocoa app doesn't become active/focussed despite using NSApp.activate()
I have this simple app where I need to be able to bring the app to front and focus its window with a keyboard shortcut:
import Cocoa
import HotKey
class ViewController: NSViewController {
...
0
votes
2
answers
62
views
Invisibly block user interaction in macOS app
In my macOS app (objC), the user can trigger tasks that can take some time, like importing files into a database. These tasks do not run on the main thread because they spawn a window (sheet) to show ...
0
votes
1
answer
32
views
macOS How to get rid of highlighted background for my NSStatusBar.system.statusItem
I am showing a menu bar button for my app:
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
if let button = statusItem.button, let img = NSImage(named: "...
0
votes
0
answers
43
views
How can I propagate undo actions from a Core Data background context to the main context in a macOS app?
I’m using Core Data in a macOS app and performing most work in a background context. However, I’d like to take advantage of Core Data’s built-in undo functionality and I’m struggling with how to ...