Questions tagged [appkit]

The Application Kit is a collection of classes provided by OpenStep operating systems such as OPENSTEP, GNUstep, and Mac OS X.

The Application Kit is a collection of classes provided by OpenStep operating systems such as OPENSTEP, GNUstep, and Mac OS X.

Apple's reference documentation describes AppKit as follows:

AppKit contains all the objects you need to implement the user interface for a macOS app—windows, panels, buttons, menus, scrollers, and text fields—and it handles all the details for you as it efficiently draws on the screen, communicates with hardware devices and screen buffers, clears areas of the screen before drawing, and clips views.

Reference

1436 questions
8
votes
1 answer

Writing classes that work in both iOS and Mac OS

What is a good way to write classes that can be used in both iOS and Mac OS applications? I'm not trying to get a full cross-platform UI solution here, just a way to use several model classes from my iPhone app in a support application running on…
James Huddleston
  • 8,410
  • 5
  • 34
  • 39
8
votes
2 answers

How to close a Full-Screen mode NSWindow programmatically?

My application has two windows(main and video) and both can enter the Full-Screen mode independently. And the main window has a button to toggle the video window's visibility. When the video window is visible, the button simply sends close message…
YoonHo
  • 1,046
  • 9
  • 10
8
votes
1 answer

Decoding integer and other masks in Cocoa

Cocoa has a plethora of integer masks and codes. For instance, NSCommandKeyMask or NSF1FunctionKey, which are clearly defined and documented in the headers. However, some can be archaic and when accessing accessibility attributes, for instance to…
the979kid
  • 635
  • 5
  • 15
8
votes
1 answer

Cocoa predefined resize mouse cursor?

Is the resize mouse cursor used by Preview (e.g. when resizing shapes) a system cursor? It's not available directly as a method in NSCursor but then it doesn't look like there's a private resource for the cursor in the Preview app's bundle…
ATV
  • 4,116
  • 3
  • 23
  • 42
8
votes
2 answers

How to relayout content of NSTextView so that my tab characters are drawn with width of 4 characters

I'm working with an NSTextView and one of the requirements I have is that a tab character, '\t', shall have the same width as four spaces. So the text-content would look like this: AAAA AAAA - 1 tab AAAA - 4 spaces And this is how I…
Lyndsey Ferguson
  • 5,306
  • 1
  • 29
  • 46
8
votes
1 answer

Mac OS X replacement for NSFetchedResultsController

So I'm used to iOS development so I'm pretty happy with NSFetchedResultsController. However, this is not present in the Mac OS X environment. I know that I can use NSArrayController as a replacement. I might be using this class terribly wrong but it…
lbrndnr
  • 3,361
  • 2
  • 24
  • 34
8
votes
3 answers

Menu Bar App Never Becomes Reactivated

I'm building a Mac app that only sits in the menu bar with no dock item and no key window and no main menu (it's LSUIElement in the info.plist is set to YES). When I first launch the app, applicationDidBecomeActive: is called, as I expect. However,…
Ash Furrow
  • 12,391
  • 3
  • 57
  • 92
8
votes
3 answers

How to obtain the selected text from the frontmost application in macOS?

I will soon be working on an application which needs to get the currently selected text in the frontmost application window, be it Safari, Pages, TextEdit, Word, etc., and do something with that text. My goal is to find a solution that works with as…
Form
  • 1,949
  • 3
  • 25
  • 40
8
votes
2 answers

Encoding NSViewController for Lion's user interface resume feature

Any idea what are the best practices for archiving an NSViewController inside a window for resume (user interface preservation) purposes? I've tried archiving it in the window controller's encodeRestorableStateWithCoder: methods only to find out…
adib
  • 8,285
  • 6
  • 52
  • 91
8
votes
6 answers

How to change color of divider in NSSplitView?

Can we change the color of the divider? Apple documentations says, that we can override -dividerColor in subclass of NSSplitView for this, but it doesn't works for me, or my understanding isn't correct. Also I've try create color layer over divider,…
Akki
  • 1,487
  • 14
  • 25
7
votes
2 answers

What does “initial position” do in Xcode's nib editor?

Editing my nib for a document-based Cocoa application, I see that when I have a window or panel selected, Xcode lets me set its “initial position”: This is separate from the window's Frame, which is above it, so what is this? What uses the “initial…
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
7
votes
4 answers

How to put SwiftUI button into NSToolbar?

This is how SwiftUI can be inserted into NSToolbar using an accessory view controller: import SwiftUI import PlaygroundSupport var hostingView = NSHostingView(rootView: ZStack { Color.clear HStack { Text("Hey") …
Vadim
  • 9,383
  • 7
  • 36
  • 58
7
votes
2 answers

How to detect active appearance for NSView or for its parent NSWindow?

All native controls have different appearance when their parent window is active or inactive. How should we check this state in custom components e.g. while rendering a button cell? We could inspect controlView.window’s properties like isMainWindow…
Vadim
  • 9,383
  • 7
  • 36
  • 58
7
votes
1 answer

`ImportError: No module named AppKit` after installing AppKit and PyObjC

I'm trying to get some Python code working on a fresh installation on Anaconda on Mac OS X Mojave with Python 2.7. This was all stuff that was working before on the same machine. The error I'm getting is this: Mac:~ kuzzooroo$ python Python 2.7.15…
kuzzooroo
  • 6,788
  • 11
  • 46
  • 84
7
votes
1 answer

Is drawing to an MTKView or CAMetalLayer required to take place on the main thread?

It's well known that updating the user interface in AppKit or UIKit is required to take place on the main thread. Does Metal have the same requirement when it comes to presenting a drawable? In a layer-hosted NSView that I've been playing around…
kennyc
  • 5,490
  • 5
  • 34
  • 57