New in iOS 7: What developers need to know
The revamped UI, dynamic type, new multitasking modes, and 64-bit support point to new classes of apps -- and devices
Making text legible
Another way Apple put those extra screen pixels to use was to support better typography. iOS 7 implements dynamic type: typefaces that can scale to all sorts of sizes and still retain their shape and weight. Instead of point sizes or type families, you simply specify a style and let iOS handle the details.
There are a number of style types to choose from, and they parallel those found in HTML tags: Headine 1, Headline 2, Subheadline 1, Subheadline 2, Body, Footnote, Caption 1, and Caption 2. If necessary, you can tweak the size and character spacing, again using semantic terms rather than actual point sizes. Support for dynamic type, ligatures, kerning, and accessibility type sizes are supported throughout the OS.
A new framework, TextKit, implements the dynamic type features. It is a high-level text layout API layered over the low-level CoreText text layout engine. All text-related UI elements (such as
UITextView) now use TextKit to manage text layout. TextKit can readily arrange styled text into paragraphs, columns, and pages. For complex layouts in which graphics are combined with text, you simply provide a Bezier path that outlines the graphic. TextKit lays out the text and avoids placing text within the path. This goes a long way toward supporting more sophisticated content delivery.
For the record, iOS was a full-blown multitasking OS from the very beginning. At its core iOS uses the same Mach kernel and BSD libraries as its desktop sibling, OS X. Certain apps, such as Mail, Music, and Clock, ran in the background. However, Apple restricted access of third-party apps to the multitasking capabilities for security purposes, and the early hardware was limited in processing power, memory, and battery life anyway.
In iOS 4, limited multitasking was introduced to support apps that performed background audio playback, background location tracking, and push notifications. In iOS 7, several new background modes have been added: background fetch, remote notifications, and background transfers. The purpose behind these new modes is to keep your app's data current at all times -- even if the data updates come from a remote server.
Background fetch allows an app to fetch information periodically. To implement this, you notify iOS of the fetch interval using a
UIApplication method call. Based on the interval, iOS periodically launches your app. Your app then invokes a fetch delegate method that grabs the data and exits.
Remote notification allows your app to respond to messages pushed from a server. iOS launches your app when the notification arrives. The app connects to the server, collects the payload, then exits.
Background transfers enable your app to manage larger data transfers. Your app launches and uses a delegate method that starts a session with a server. The delegate handles authentication to the server and possibly multiple transfer operations.
For all three multitasking modes, the app must call a completion handler that reports to iOS if the fetch operation was a success or not. In the event of a failure, iOS can restart your app later to retry the fetch or transfer.