Skip to content

Instantly share code, notes, and snippets.

@TheCodeEngine
Forked from jwilling/gist:4186817
Created August 5, 2013 08:14
Show Gist options
  • Save TheCodeEngine/6154222 to your computer and use it in GitHub Desktop.
Save TheCodeEngine/6154222 to your computer and use it in GitHub Desktop.

Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.


##NSView##

  • NSView does not have the ability to set an affine transform.
  • Controls that have cells (such as NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed.

##NSViewController##

  • NSViewController could be more useful. It has -loadView but no other lifecycle methods.

##NSClipView##

  • NSClipView has performance issues.

##NSTableView##

  • NSTableView has odd animation artifacts when scrolling with the keyboard with a fast key repeat.
  • NSTableView does not fully support sections – all rows in the table are numbered sequentially, rather than as (section #, row #) as UITableView does. This makes it difficult to alter sections independently.

##NSCollectionView##

  • NSCollectionView is not performant. It loads every single cell all at once, and it keeps them all in memory. It does not reuse cells.

##NSBrowser##

  • NSBrowser is not view-based like NSTableView and NSOutlineView.

##NSSlider##

  • NSSlider requires use of private method -_usesCustomTrackImage in order to completely customize appearance.
  • NSSlider needs a "rounded textured" style for use in window frames (like in Finder).

##NSSearchField##

  • NSSearchField does not support tokens.

##NSTextField##

  • NSTextField does not support a custom context menu when the text is selectable and/or editable. It requires hacking around with the field editor to implement this functionality.

##NSSplitView##

  • NSSplitView makes simple customization like setting priorities and min/max sizes for views is unnecessarily complex.

##NSProgressIndicator##

  • NSProgressIndicator still draws the original progress bar even if drawing is overridden.
  • NSProgressIndicator's color cannot be changed without workarounds such as Core Image filters.

##NSPopover##

  • NSPopover does not offer a way to customize its appearance apart from the two default styles.
  • NSPopover steals keyboard focus.

##NSWindow##

  • NSWindow animation is poor without the use of some not-so-nice hacks.
  • Borderless NSWindows (NSBorderlessWindowMask) do not have the ability to round their corners.
  • Borderless NSWindows with a layer-backed content view do not get a shadow.
  • NSWindow is really difficult to customize.

##NSDocument##

  • NSDocument has very bad support for documents that aren't fully loaded into memory. Nearly all of the API assumes that you can generate a singular NSData object to store your document in, which isn't true if half of your document is on disk only and the other half in memory only.
  • NSPersistentDocument doesn't support file wrappers (bundles), even though that's a requirement for the sqlite data storage with sandboxing enabled. All workarounds at this point are huge hacks.

##NSObjectController##

  • While NSObjectController and its subclasses (e.g. NSArrayController) support retrieving objects from a Core Data managed object context, they do not offer a way to receive per-change notifications. This means that you need to reload your entire view vs. inserting/removing/moving the cells that were updated. Ideally, we would want a port of NSFetchedResultsController.

##NSDrawer##

  • NSDrawer should either be deprecated or have its API fully updated to support customization.

##NSImage##

  • NSImage does not support drawing stretchable images with caps.

##Field Editors##

  • Field editors are conceptually unusual and confusing.

##Cells & Controls##

  • The use of cells in specific controls such as NSTextField and NSButton make them difficult to customize.
  • NSButtonCell is poorly thought out. bezelStyle, gradientType, buttonType, isHighlighted, state and a few more make for a really really confusing subclassing experience.
  • NSTextFieldCell does not have vertically-centered text. A subclass is required.
  • Template images and window-style engraved text should be useable without the use of captive cells.
  • AppKit controls need image-based customization properties like their UIKit counterparts.
  • AppKit does not provide HUD-styled controls.
  • Interface Builder does not support bindings for custom controls.

##Misc. (not necessarily AppKit)###

  • There is no Cocoa wrapper for the Carbon hotkeys API.
  • There is no Cocoa wrapper for FSEvents. The Spotlight stuff doesn't really work for sandboxed Applications.
  • There is no API for AirPlay.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment