7.8 · Keyboard shortcuts, pointer, Apple Pencil and multitasking
iPad apps share most of UIKit with the iPhone, and then add keyboards, trackpads, a pencil and resizable windows. The expectations are different: the app must work with whatever input is present.
Mental model. Do not assume a finger. Handle input through actions (commands, gestures, menus) that any device can trigger, and let the window decide its size.
Beyond touch
Keyboard shortcuts, pointer and the pencil.
- How do you support hardware keyboards, shortcuts, menus and the pointer on iPad?
Make every action reachable beyond a tap. Keyboard shortcuts come from UIKeyCommand: declare an input and modifierFlags (such as .command) and an action, and… - How do you handle Apple Pencil input, and how does multitasking change your layout assumptions?
Apple Pencil arrives as ordinary touches with extra information. A UITouch has a type (.pencil versus .direct), force, altitudeAngle and azimuthAngle. Because…
More in UIKit
- 7.1 · Hit testing, the responder chain and gesture recognisers
- 7.2 · UIView and CALayer, frame, bounds and center
- 7.3 · View controller lifecycle, containment, presentation and transitions
- 7.4 · Navigation, tab, split and page controllers
- 7.5 · Compositional layout, diffable data sources, cell reuse and prefetching
- 7.6 · UITableView, still asked and still everywhere
- 7.7 · Trait collections, size classes, safe area, keyboard and appearance
- 7.9 · Hosting SwiftUI in UIKit and UIKit in SwiftUI
- 7.10 · Initialisers, stack views, scroll views and modern buttons
- 7.11 · Layout passes, retain cycles and menus
- 7.12 · Refreshing diffable cells, outlines and carousel layouts
- 7.13 · View-tree exercises and long navigation stacks