1,550 questions
0
votes
1
answer
42
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
18
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
310
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 ...