What are some AppKit components used to construct modern Mac document-based apps in 2014?

StackOverflow https://stackoverflow.com/questions/23135516

  •  05-07-2023
  •  | 
  •  

Pregunta

I’m risking this question getting closed as “not constructive / argumentative”, as there is no single definitive answer that I’m looking for… but I hope we can make this work. Bear with me.

So. Let’s talk about Mac apps. Cocoa and AppKit are the workhorses on Mac desktop, that can be used to construct classic-looking Mac UI-s. Here’s an example.

iTunes preferences

The iTunes preferences dialog is a classic-looking Mac UI. Standard toolbar, checkboxes, sliders, separators, buttons. Mac engineers know how to make these, and it’s easy and fun these days with AutoLayout & co.

More recently, though, another style of Mac apps is emerging, that I’d call “modern” apps. In particular, I’m interested in document-based apps, where the document is single-window, decorated with crisp-looking sidebars and other components. Here are two examples (Sketch and Pages).

Sketch

Pages

I’m interested in ideas about how these UI-s are constructed, and what kind of components are used. Is AppKit sufficient to achieve this? I read somewhere, but can’t recall the reference, that iWork these days largely forgoes AppKit and the UI just consists of a bunch of hand-drawn CALayers. I’m not so much interested in the document canvas (a whole another subject) as I am in the sidebar, toolbar and their contents.

OK, let’s try to salvage this question with some specific subquestions…

  1. General window composition for both apps—is it NSToolbar on top, and NSSplitView in the body area, or something more?
  2. Sketch tree view on the left—can I achieve this with NSOutlineView, or is there something more going on?
  3. Pages sidebar—what kind of AppKit components are used here, vs custom drawing? (One curious fact that tells me that custom drawing is going on—when I expand/collapse the “Spacing” or “Bullets & Lists” sections, there is no animation.)
¿Fue útil?

Solución

Don't be fooled by current design choices. IMHO we're building apps the same way we always did it, albeit single window interfaces became more popular in recent years. But that's just a matter of whether you stuff your NSView subclasses in subviews or dedicated windows.
The views themselves shouldn't care at all - in a good application design.

The apps you've mentioned use a mixture of custom and standard controls.

Like apps always did - back to the days of NextStep (or System 7).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top