Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AppKit for iOS Developers

Delisa Mason
September 19, 2013

AppKit for iOS Developers

Pitfalls and tips for working with AppKit for those familiar with building iOS apps

Delisa Mason

September 19, 2013

More Decks by Delisa Mason

Other Decks in Programming


  1. AppKit for iOS Developers

  2. @kattrali Delisa Mason

  3. AppKit - gui framework for os x - perspective of

    ios developers branching out - familiar to uikit users - refinements and cruft of age - not all UI to NS
  4. Pitfalls - assumptions and common pitfalls to cover - frame

    in common classes to encounter - not necessarily about porting
  5. ? why? - less constraints on distribution and memory usage

    - more intensive computation - it is cool
  6. - better companion experiences to ios apps

  7. Designing Your App - ask how is it most useful

    to users
  8. ˒  - something a user wants while in multiple

    apps? - persistent utility - maybe launches at start up
  9. ˒  ? TheApp - accomplishes particular task - front

    and center - may be single use; disappear with the window
  10. ? - an experience requiring the entire screen all the

    time - game - system-altering utilities
  11. 1 2 3 - design a view flow - make

    a nib
  12. @interface MyViewController : NSViewController @end @implementation MyViewController - (void) viewDidLoad

    { // initialize some stuff } @end - lay out some code - does nothing
  13. NSViewController?

  14. NSViewController • commitEditingWithDelegate:didCommitSelector:contextInfo: • commitEditing • discardEditing • initWithNibName:bundle: •

    loadView • nibBundle • nibName • representedObject • setRepresentedObject: • setTitle: • setView: • title • view - instance methods - no view loading stage selectors - willLoad, didAppear
  15. NSViewController? - not the controller

  16. NSViewController

  17. NSWindowController •manages a window, usually loaded from a nib •has

    window loading stage selectors •windowDidLoad •windowWillLoad
  18. 1 2 3 - change to windows

  19. 1 2 3 - link them up with nsnavigationcontroller ......?

  20. NSNavigationController? where it at?

  21. NSNavigationController there’s no nsnavigationcontroller! - how often do you have

    desktop apps change context entirely? - is it a good experience?
  22.  TheApp - focus should remain task or document -

    taking away context is unexpected
  23.  TheApp Subview subviews slide in to add additional functionality

    while preserving context
  24.  TheApp NSPanel nspanels add additional contextual tooling

  25.  TheApp Stuff NSMenu maybe no window at all -

    menus for comprehensive lists of actions
  26.  TheApp HUD-style NSWindow huds for ephemeral views, like previewing

  27. NSWindow ≠ UIWindow SIDEBAR - nswindows have more sizes, shapes,

    types - not always full screen - not always focused - people close them, - app keeps running
  28. Displays Multiple Sizes, Resolutions, Pixel Densities - windows on many

    more types of displays - keep in mind when designing interactions - that said, favorite interaction
  29. Presenting Users with Choices for which they need to select

    from big list
  30. Making a Selection •Segmented Controls •Sliders •Combo Buttons •Radio Groups

    •Table Views - several controls suited to users performing a selection - focus on table view
  31. Making a Selection •Segmented Controls •Sliders •Combo Buttons •Radio Groups

    •Table Views - ios use is common - handy and unnecessarily complex flow chart
  32. Use NSTableView? Does the list need to be visible for

    a while? Sure NOPE yes no
  33. Use NSTableView? Complex sidebar Persistent lists Spreadsheets - customized sidebar,

    not better served by a source list, a la finder - or central focus on a dataset is purpose of the app
  34. NSTableView •Cell-based or view-based content modes •Columns nstableview is well-suited

    to these kinds of functions - cell-based, as in cell in a spreadsheet, plain text - view-based, as in it has subviews, and probably custom layout - different delegate methods by content mode - more than one column, concern for cell population - sometimes easily built by bindings
  35. Bindings favorite things to love and hate

  36. Bindings •Connects data and presentation •Integrates into interface builder •Can

    reduce “glue code” •Alternately invoked via bind:toObject:withKeyPath:options: - reflects changes bidirectionally - content and most interface elements connect controller property or model
  37. Bindings key-value observing key-value coding - not magic - layer

    on top of kvo/kvc - good to remember for debugging horribly wrong connections - refer cocoa bindings programming reference
  38. General Advice

  39. 1. Read the OS X HIG its a bit lengthy

    - covers usage of interface elements in depth - definitely not the same as the iOS HIG
  40. 2. Get down with Core Graphics or you will never

    figure out how to change the background color of an nsview
  41. 3. Use documentation if nothing else, for naming conventions nsalert,

    nsmakerect, webview
  42. Thank you!