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
10
votes
1 answer

Is there something equivalent of UIActivityViewController in OSX?

I am migrating an application from iOS to OSX, Is there something equivalent of UIActivityViewController in OSX . For things like Facebook, Twitter, mail , Message sharing, I need to do something like; NSArray *activityItems = [NSArray…
real 19
  • 748
  • 8
  • 32
10
votes
1 answer

Reusable NSView from .xib

In several parts of my application, I need a control where a user can enter a password. The password field is secure, however I want the user to have the ability to switch the field to plain text and check for typos, etc. The password field itself…
TheNextman
  • 12,428
  • 2
  • 36
  • 75
10
votes
1 answer

Autolayout is resizing my window

I have a nib with autolayout enabled containing a view controller's views and, separately, a window with a placeholder view to add them it into. The placeholder has constraints relative to its superview and other views in the window, and before…
Pierre Houston
  • 1,631
  • 20
  • 33
9
votes
5 answers

Why isn't applicationShouldOpenUntitledFile being called?

I added a applicationShouldOpenUntitledFile method to my application delegate, returning NO as Apple's documentation specifies. However, I'm still getting a new document on startup. What's wrong? @implementation AppDelegate @synthesize window; -…
Steven Fisher
  • 44,462
  • 20
  • 138
  • 192
9
votes
1 answer

SwiftUI on MacOS. - Opening a new Window

In my MacOS SwiftUI App I want to display some views in new Windows. The calls shall be possible from several parts of the code so I decided, do implement it as a static func of as special struct like this. Works fine - there is something to be said…
mica
  • 3,898
  • 4
  • 34
  • 62
9
votes
1 answer

SwiftUI View to NSImage in AppKit

SwiftUI 2.0 | Swift 5.4 | Xcode 12.4 | macOS Big Sur 11.4 In iOS there is a way to render SwiftUI views to a UIImage that doesn't work in AppKit, only UIKit: extension View { func snapshot() -> UIImage { let controller =…
AlbertUI
  • 1,409
  • 9
  • 26
9
votes
1 answer

SwiftUI: Detect finger position on Mac trackpad

I'm making a SwiftUI app for macOS and I'd like to use the trackpad as an (x, y) input by detecting the position of the user's fingers. I wanna be able to detect multiple fingers that are resting on the trackpad (not dragging). How do I do that? A…
qitianshi
  • 619
  • 8
  • 19
9
votes
1 answer

Embed a SwiftUI view in an AppKit view

I have a SwiftUI view MySwiftUIView: import SwiftUI struct MySwiftUIView: View { var body: some View { Text("Hello, World!") } } I want to use it as part of an AppKit view. I tried the following code: import Cocoa import…
9
votes
1 answer

How can I handle shortcuts when LSUIElement is set to YES?

When LSUIElement is set to NO most of shortcuts are handled by application's main menu. But when LSUIElement is set to YES, there is no main menu and then no common shortcuts are forwarded to a first responder. The naive solution would be overriding…
Kentzo
  • 3,881
  • 29
  • 54
9
votes
0 answers

Should You Still Subclass NSControl in 2018

As of 2018, what is the correct way to create a custom control with AppKit/Cocoa? The traditional technique has been to subclass NSControl and/or NSCell for the type of custom control you're implementing. (Such as an NSButton that does custom…
kennyc
  • 5,490
  • 5
  • 34
  • 57
9
votes
2 answers

Matching AppKit and SpriteKit colors

I am building a small utility app for macOS that combines SpriteKit with AppKit. Specifically, I am using an SKView as the "background" for the app window (mostly for specific types of animations that are easier in SpriteKit). I am also changing…
Hartix
  • 310
  • 3
  • 13
9
votes
1 answer

How to get the Objective-C class name corresponding to an AXUIElement?

Apple's Accessibility Inspector tool displays the Objective-C class corresponding to the currently inspected UI Element. See NSButtonCell at the very bottom of this screenshot: However, how can I extract this information in my own code? The…
MrMage
  • 7,282
  • 2
  • 41
  • 71
9
votes
8 answers

How to collapse an NSSplitView pane with animation while using Auto Layout?

I've tried everything I can think of, including all the suggestions I've found here on SO and on other mailing lists, but I cannot figure out how to programmatically collapse an NSSplitView pane with an animation while Auto Layout is on. Here's what…
mdiep
  • 373
  • 2
  • 8
9
votes
1 answer

Why is NSCell deprecating and why was it introduced in the first place?

The "Gradual deprecation of NSCell" section of AppKit Release Notes for OS X v10.10 says: Mac OS X 10.10 takes another step towards the eventual deprecation of cells. I heard that NSCell was introduced for performance reason. But then why it is…
Ethan
  • 18,584
  • 15
  • 51
  • 72
9
votes
2 answers

How to initialize a NSWindowController in Swift?

I want to initialize a window controller object from a nib file, quite easy right? But I simply can't get it to work. According to my previous experience in ObjC, I've written down the following code: init() { super.init(windowNibName:…
Void Main
  • 2,241
  • 3
  • 27
  • 36