1,551 questions
0
votes
0
answers
4
views
How do I linkify text in an NSTextView using TextKit 2?
I'd like to linkify text in an NSTextView. I know about the isAutomaticLinkDetectionEnabled property, but that is only for text typed in. If I programmatically set the string or paste in text, it won'...
0
votes
1
answer
43
views
Appkit Cocoa - NSCoding decoding error - NSCocoaErrorDomain 4864
I'm having some trouble with NSCoding, I have this simple "Grade" class:
@interface Grade : NSObject<NSCoding>
@property (copy) NSString *name;
@property NSInteger grade;
@end
It ...
0
votes
0
answers
9
views
Appkit & Cocoa - How to support editing for a view-based NSTableView? [duplicate]
So I have a view-based NSTableView whose contents are stored in an NSMutableArray. Basically I created a table view in the storyboard and inserted a control of type "Image and Text Table CellView&...
0
votes
0
answers
19
views
validateToolBarItem not called
In my mac application, validateToolBarItem: isn't called after a row of a NSTableView is dropped.
The docs list events that don't trigger toolbar validation, but mouseUp: isn't one of them. So I'm not ...
1
vote
1
answer
44
views
Cocoa - Block implicitly retains 'self' - Different solutions
So I have this snippet here which involves a block:
NSArray<Class> *acceptableClasses = @[[DesktopEntity class]];
__block NSInteger insertIdx = row;
[info ...
0
votes
1
answer
80
views
How to get the 'com.apple.icns' data of a file for filling the pasteboard?
When one copies a file in Finder, the pasteboard contains a 'icns' type with the various icon descriptions of the copied item(s).
I need to accomplish the same effect in my code, i.e. generate the ...
0
votes
1
answer
55
views
Can't change the font size of an NSTableView
I'm following this code here where
I have an NSTableView that displays the folder name as a group header and then the contents of the folder below, for this example these are all images.
So like, ...
-3
votes
0
answers
50
views
How did developers implement Auto Layout in the old days?
These days, we implement Auto Layout using NSLayoutConstraint. However, this has been available only since iOS 6.0 and Mac OS X 10.7.
Before iOS 6.0, layouts had to be adapted to resolutions like ...
0
votes
1
answer
27
views
SKLabelNode keeps jumping back and forth when displaying different numbers with equal number of digits
I'm trying to display a right-aligned timecode in my game. I had expected that digits would all have the same width, but this doesn't seem to be the case in SpriteKit, even though it seems to be the ...
0
votes
1
answer
38
views
How can an application check if it has permission to control another application through AppleScript without blocking?
I'm writing an AppKit macOS application that will use AppleScript / Apple events to automate another application. I need to know ahead of time whether or not my app has permission to do this for the ...
0
votes
1
answer
37
views
NSWindow with SwiftUI content has zero frame on macOS 15
As title says. I create a window as such:
onboardWindow?.setFrame(.init(x: 0, y: 0, width: 600, height: 400), display: false)
Then, when it's time to show:
let contentView = WelcomeView()
let ...
1
vote
1
answer
311
views
Simulating Fn + Control + arrow key events ignores Fn
I want to simulate the pressing of Fn (Globe)+Control+Right Arrow, but I’m encountering an issue where the Fn modifier seems to be ignored, and the system behaves as if only Control+Right Arrow is ...
0
votes
0
answers
45
views
Overlay NSTextLayoutFragment with CATextLayer
I'd like to overlay a NSTextLayoutFragment with a CATextLayer. The idea being that I could then hide the fragment, animate the CATextLayerand then unhide the NSTextLayoutFragment at the end of ...
0
votes
1
answer
62
views
How to Get Display Names of Connected Displays in macOS Using Swift
I’m trying to retrieve a list of names of the displays connected to my Mac. Using NSScreen, I can get the list as follows:
func getDisplayNames() -> [String] {
var names = [String]()
guard !...
0
votes
2
answers
151
views
Swift data race with AppKit MPMediaItemArtwork function
Consider the code below. It uses the AppKit (macOS) MPMediaItemArtwork function to set the artwork in MPNowPlayingInfoCenter.
During runtime, when compiled with Swift 6, this gives the warning:
...
0
votes
1
answer
35
views
Cocoa App trying to display document icon despite not being document based
I'm working on a Cocoa/AppKit Mac app, and after customizing the File menu items (save and new), I now get a blank document icon on my app. My app is not document based however, so it simply displays ...
0
votes
0
answers
23
views
Xcode downloads client crash report but the stacktraces don't contain any of my app's symbols
All the threads only contain system calls. The crashed thread only contains a single call to my app's code which is main.swift:12.
What could cause such a crash?
Process: MyApp [83642]
...
0
votes
0
answers
60
views
NSEvent.addGlobalMonitorForEvents inside XPC Service
I have an issue with XPC Service not being able to register global event handler for mouse clicks.
The XPC Service setup has nothing extraordinary. A usual XPC Service. Starts and works just fine. The ...
0
votes
0
answers
70
views
Can't get NSTrackingArea enabledDuringMouseDrag to work
I'm trying to implement a right-click-and-drag operation to link two NSViews, in a very similar manner to creating constraints in the Xcode Interface Builder. I want the target NSView to respond to ...
0
votes
0
answers
42
views
NSHostingView inside table cell view isn't automatically updating row height
When adding a constraint NSHostingController view to a table cell view, the row height isn't automatically adjusted to fit the SwiftUI views content thought I activated usesAutomaticRowHeights on my ...
0
votes
0
answers
93
views
macos background app SwiftUI TextField copy paste not working
I have this Form with two TextField's. When I attempt to use the copy paste shortcuts (CMD + C, CMD + V) within each TextField, I hear the typical macOS system interrupt sound, with no changes to the ...
-1
votes
1
answer
58
views
NSWindow is super tiny
I have a simple SwiftUI code to start a small NSWindow, like given below. However when the window appears, it's super small and ignores the minsize.
...
Button("Test Window") {
let window ...
1
vote
1
answer
51
views
macOS app and extension: How to send x,y data from HIDStylusDriver to StylusApp to Pen/Draw?
I am using HIDStylusDriver to handle stylus input:
I have a touch screen and I want to:
Control the screen. I can enable the extension and control the touch screen successfully.
Draw on this screen. ...
0
votes
0
answers
32
views
Is there a non-deprecated replacement for NSCursor.currentSystemCursor?
I'm writing a macOS application that needs to get an image of the current system cursor. I can use NSCursor.currentSystemCursor but it's marked as deprecated starting with macOS 15. Is there a ...
0
votes
0
answers
11
views
NSTitlebarAccessoryViewController State Restoration Timing
I am using NSTitlebarAccessoryViewController objects in my Cocoa app. I have implemented state restoration for the NSWindow and it appears to be working correctly as previous NSWindow objects along ...
0
votes
0
answers
17
views
NSApplicationPresentationDisableHideApplication is not disabling the "Hide" option from the dock menu
I am trying to use the following code to disable the Hide option for my application :
NSApplicationPresentationOptions options = [NSApp presentationOptions];
options |= ...
0
votes
0
answers
44
views
NSScrollView with large content is creating a huge number of tiles upon redraw - in some cases
The main view of my application is an NSScrollView. When the document size is large, say 24k x 17k pixels (approximately 30 x 30 landscape pages), when the magnification of that view changes from ...
0
votes
0
answers
52
views
Why initializing an UIImage or NSImage with ImageRessource is not a failable initializer?
This question covers UIImage as well as NSImage. Both types have some failable initializer, like this one:
init?(named name: String)
And this makes perfectly sense, since the resource could not be ...
0
votes
0
answers
36
views
Can't achieve NSButton behavior like in macOS Quicklook
Quicklook contain this button:
Idle:
Hover:
Active:
Can't achieve it with any settings, closest look I've got is having Idle and Active states, but on hover nothing is happening:
let button = ...
0
votes
1
answer
110
views
How to Create a Slide-in Animation on macOS Using AppKit
I'm attempting to create a slide-in animation for a window on macOS using AppKit, but I'm encountering some issues with the animation behaviors.
Animating by Changing the X Coordinate: When I animate ...
0
votes
0
answers
54
views
How can I resolve this issue where my makeView call on NSTableView is always nil?
Can’t Make NSTableCellView in Programmatic UI NSTableView When calling makeView(identifier:owner:)
Hello all. I’m trying to put together a basic example of a NSTableView using programmatic UI instead ...
0
votes
1
answer
125
views
How does the NSWindow isReleasedWhenClosed property work when using ARC?
In Objective-C with ARC or Swift (which always uses ARC), what difference does it make whether isReleasedWhenClosed is true or not? Won't a window be kept alive as long as my code has strong ...
1
vote
1
answer
39
views
`NSTask.run()` fails with `The operation couldn’t be completed. Permission denied`
I am trying to open a text document from within my SwiftUI app on macOS.
Unfortunately, I get the error The operation couldn’t be completed. Permission denied. How can I work around this?
I tried with ...
0
votes
0
answers
59
views
SwiftUI Window not draggable
I made a custom AppDelegate which should remove the window toolbar and add a corner radius of 10px which all works very well hoeever now, you can't drag the window around.
I am also very new to AppKit ...
0
votes
0
answers
51
views
`NSWorkspace.open` fails with error `The application “TextEdit.app” could not be launched because a miscellaneous error occurred.`
I am trying to use NSWorkspace.open(_:withApplicationAt:configuration:completionHandler:) to open the currently open document in my document based SwiftUI app.
Clicking on the button shown in the ...
0
votes
0
answers
22
views
Crash in AVPlayerView.setPlaybackControlsViewController
A user of my app, which shows subtitles loaded from a text file on top of a video loaded from another file, reported that it crashes within minutes of launching it. The user confirmed that the crash ...
0
votes
0
answers
39
views
Content hugging priority for the NSTableColumn in the view-based NSTableView
I have a simple view-based NSTableView with two columns: Name and Value (each cell contains a NSTextField-s)
I want to use the the screen space as much as possible to be able to display the long ...
0
votes
1
answer
49
views
How to properly replace NSTextView's string when used with bindings
I have issues with string replacement when there are newlines.
How to properly replace string or part of a string so that bindings are triggered.
I have used open func replaceCharacters(in range: ...
0
votes
1
answer
136
views
Understanding virtual environments on VSCode vs Anaconda vs Global Python base (Why does my AppKit installations work for Conda but not rest) [duplicate]
I was trying to install AppKit and came across numerous errors of meta package not existing and pycairo not being able to be downloaded. I went through stackoverflow and tried different pip install ...
2
votes
1
answer
43
views
NSPanGesture not working on AppKit but UIPanGesture works on iOS (Multiplatform App)
I found an old SwiftUI library that I've attempted to port to MacOS. You can find the full repo here: https://github.com/cyrilzakka/SlidingRuler. Essentially it's a sliding ruler with ticker ...
0
votes
0
answers
34
views
Can I position a NSWindow in a specific Space
How can I position a NSWindow in the correct Space?
I'm building a companion app that tracks another application. I'm able to position the companion correctly most of the time using setFrame. However ...
0
votes
1
answer
60
views
Can in-app purchases via StoreKit work on macOS in a Developer-ID signed app?
This seems like an obvious question, but I can't find documentation on it anywhere. If I have an app in the Mac App Store with in-app purchase functionality, and I build and sign it using my Developer-...
0
votes
0
answers
26
views
NSPageController to navigate in vertical direction
I am working MacOS application which has a menu on the left and panels on the right switches back and forth as we select a menu.
I would like to achieve the panel switching logic with NSPageController....
2
votes
1
answer
130
views
SwiftUI TextEditor bound to $[Note].content — slow performance?
I'm building simple text editor, which can handle several opened files. I have NotesManager, which stores all opened documents, and I pass binding to each of these notes to views using NavigationLink.
...
1
vote
1
answer
36
views
How to change background color of xamarin.mac app?
I have basic xamarin.mac app and I don't know how to change his background color.
// viewcontroller.cs (c#)
using System;
using AppKit;
using Foundation;
namespace Application
{
public partial ...
0
votes
0
answers
47
views
Tipkit :: TipNSpopover :: In Mac OS application Unable to close the popover when we clicked on cross icon presented in TipNSpopover view
By implementing the Tipkit framework in the Mac OS application, we were unable to close the popover when we clicked on the cross icon presented in TipNSPopover View.
And anyone please guide me for ...
1
vote
1
answer
97
views
Problem of alignment with NSStackView in a custom table view
For my cross-platform project (Mac & Windows), I coded a generic C++ collection view (i.e. table view) leveraging the NSStackView from the AppKIt in Objective-C (as I can mix ObjC and C++ together ...
-1
votes
1
answer
105
views
How to get macOS wallpaper image URL which respects the current color scheme?
I am looking to get the URL of the current wallpaper image on macOS, which also takes the current color scheme into consideration when using wallpapers with a different appearance based on the active ...
0
votes
1
answer
91
views
How to pass a Rust function as a selector into NSMenuItem.action using objc2?
I have the next code to build an application menu in AppDelegate (an AppDelegate code was taken from the official example):
impl AppDelegate {
fn new(mtm: MainThreadMarker, menu: Option<Menu>...
-2
votes
1
answer
32
views
Customize the highlight color of a NSTableRowView [duplicate]
I’d like to
Set the emphasized background red.
Preserve the behavior of replacing the emphasized background with unemphasizedSelectedContentBackgroundColor when the content is not key (e.g. we select ...