Widgets in iOS 8: Explained

  • Thread starter Thread starter Rene Ritchie
  • Start date Start date
R

Rene Ritchie

59aa17e37ad1d2eef19a94a1a67caabe.jpeg

Extensibility is one of the biggest new features in iOS 8 — and OS X Yosemite —because it's also one of the most important, most enabling new technologies to come to Apple's mobile platform since the launch of the App Store. With Extensibility, developers can project their app's interface and functionality into everything from Notification Center and Share Sheets to DocumentPicker, custom keyboards, and other apps. What's more, they can do so securely, using the phenomenal encryption built right into iOS. The Notification Center part is all about widgets in the Today view. So, how does that work?

Days of widgets past


3e85e531147e55153ab2c53e3aa26a2c.jpeg

The idea of "widgets" date back to the early days of graphical user interface (GUI) computing. The Xerox Star, Apple's Lisa and Macintosh, Microsoft's Windows, and others, were all based on the "desktop metaphor". While that included things like files and folders, notebooks and ledgers, it also included tools like calculators and calendars. The pixels may have been chunky, the colors next to nonexistent, and the internet still just a dream, but it was a beginning.

With the rise of ubiquitous online connectivity, widgets took on a new roll: dedicated, glance-able information containers. Apple introduced their vision of web-based widgets in OS X Tiger with Dashboard.

The original iPhone was supposed to include a version of OS X-style Dashboard widgets, namely Weather and Stocks. They wouldn't have looked or acted any differently than any other full-screen iPhone app, but they would have been built like Dashboard widgets, using Apple's web technologies instead of native Objective-C. Since the presentation was to be no different, and the limits of WebKit at the time meant performance wasn't as good as native apps, they were ultimately rewritten in Objective-C anyway.

Other platforms, including Nokia (pre-Windows Phone) and Android went ahead with widgets. What's more, they distinguished them from full-screen apps by making them smaller and letting them live on the home screen, amid the app icons. Power users loved them, but few mainstream customers embrace them. According to HTC, a prominent vendor of Android devices:

  • Widgets aren't widely used – weather, clock and music are the most used and after that, fewer than 10% of customers use any other widgets.
  • Most of you don't modify your home screens much. In fact, after the first month of use, approximately 80% of you don't change your home screens any more.

With iOS 5, Apple brought limited widgets — our old friends Weather and Stocks — to the iPhone and iPad. Instead of putting them on the home screen, however, Apple put them in the then-brand new Notification Center.

For Apple, the iOS home screen was never meant to be a destination but rather a transport. It was never meant for anyone to stop and stare at, but to quickly find and get into apps. When the App Store made apps more abundant, Apple added Spotlight as an ancillary way to help do just that.

Notification Center changed things. It could be pulled down from anywhere, including the home screen (and eventually the lock screen), and more importantly, from inside any app. Instead of having to leave what you were doing to go find information, you could pull that information to wherever you were, whenever you wanted, and then go right back to what you were doing with very little cognitive load. It wasn't perfect, but it was better.

iOS 7 split notifications and widgets apart, putting widgets in their own Today view, moving Weather to the Today Summary, and adding support for Calendar, Reminders, predictive location, and the Tomorrow Summary. Yet they were still limited to built-in apps and services.

iOS 8 and Extensibility take it even further, allowing App Store apps to offer up their own Today view widgets, easily accessible from anywhere on the iPhone or iPad, informational and interactive.

How custom widgets work


2ca7b101aa808f403b012f66aa43b1cc.jpeg

If you've used Notification Center's Today view in iOS 7, you already know how custom widgets are going to work in iOS 8. You just pull down Notification Center from the lock screen (if enabled), home screen, or from within any app, and if you're not already in the Today view, you simply tap the Today tab at the top.

In iOS 8, the built-in widgets provided by Apple include Today Summary, Traffic Conditions, Calendar, Reminders, Stocks, and Tomorrow Summary.

9c3bcd0df8d5c4ff59d724ed34655fd9.jpeg

What's new is what's at the bottom: an Edit button and a notification area that tells you how many new third-party widgets are available to you. Tap the Edit button and you can enable or disable any of the built-in widgets and reorder them any way you like. Tap the New Widget notification and you can add any new, custom widget that has become available.

New widgets become available when you install an app from the App Store. If the app includes a widget, the widget notification area will tell you about it. Tap the widget you want added, and it's added. Once added, you can order App Store widgets just like the built-in widgets, and remove them if and when you decide you no longer want or need them.

For example, if you download a sports news network app, it could include a widget that presents you with up-to-date scores of the two most recent games in any league you choose to follow, as well as a headline or two of breaking news. Or, if you download a social networking app, it could include a couple status entries, and maybe a Show More option to see even more entries. A package tracker app's widget could keep you up-to-date on all your deliveries. Breaking news, latest weather — all of those, and more, could provide glance-able widgets right in the Notification Center Today view.

Interactive widgets and limitations


c72ec6b8ef00855c55ec674bbb19bcd4.jpeg

Like the new notification system, the new widget system in iOS 8 is interactive. So, not only can the widgets provide you with snippets of information, they can also allow you to perform minor tasks as well.

For example, an auction widget can show you the items you've last bid on and whether or not you're currently being outbid, but also allow you to up your bid right there in the widget and retake the lead. A social widget can let you glimpse a few entries in your timeline and Like or Repost right from the widget.

What widgets can't do is invoke the keyboard, which means widgets can't take text input the way a Messages quick reply notification can. Complex actions are also beyond the scope of widgets. So, for example, you can't change which stocks are shown in the Stock widget. They simply reflect the stocks shown in the Stocks app. In order to change the widget, you have to change the app.

How developers add widgets to apps


6811042580e4fd60f89c20c318769a8f.jpeg

For developers, widgets in the Today view are remote view controllers. They're best thought of as independent "child" apps all their own that present themselves and their data to Notification Center. That gives them a number of advantages, including security (see below). It also means that the container app doesn't need to be running in order for the widget to be working. Even if a the container app becomes a memory drain and gets jettisoned, someone using the widget at that very moment wouldn't even notice.

It's that type of seamless user experience Apple is stressing with widgets.

Performance is paramount. Since a typical person may have several widgets running at once, and resources are always limited, developers need to keep things simple and streamlined. Whenever someone pulls down Notification Center to access a widget, the data needs to be there, ready and waiting. That means pulling in anything big and new in the background and caching it so that it can persist in the widget for as long as it needs to.

For the interface, Notification Center defines the width and a default height, but developers can alter the height as needed. That's done by defining vertical constraints with Auto layout or by setting it manually in code. Widgets can also expand in size, either because the content itself changes, or as the result of a user action, like tapping a Show More button. Notification Center will handle the size change and, of course, animate it. Developers get to animate their content changes within it. However, Apple encourages developers not to make widgets so long that people will need to scroll to see all of them.

There are a number of resources available to aid in all this:

Widget security


48cfd8a623a1a52b1a5df0a838e964a5.jpeg

The thing about Extensibility and widgets is that Apple claims they provide extra functionality without sacrificing the excellent security model iOS was built on. This is a big part of the reason it took so long for App Store widgets to appear — Apple had to do a tremendous amount of work over the course of several years and several releases to make it all possible. Things like porting Apple's interprocess communication system, XPC, from OS X to iOS.

In iOS, apps are "sandboxed". That means they can only access their own data, not the data of any other app or the system. There are some exceptions, but those require the granting of explicit permission. For example to access contacts or photos, or to "open in" another app, a button tap is required. All of this so that, if anything malicious ever does manage to get in, it's very, very hard for it to go anywhere else or grab any data from anywhere else.

With iOS 8 and Extensibility, Apple keeps an app's extensions inside the app's sandbox, but allows iOS, and other apps by way of iOS, to reach out, request interface, information, and functionality. The container app can then project that interface, information, and functionality back to iOS or the host app right back.

So, for widgets, Notification Center is the host. The widget communicates only with Notification Center, not with its container app at all. (Which is why container apps don't have to be running, or can be jettisoned without affecting the widget.) When a widget needs information from its container app, it does so through iOS, and through privately shared data resources.

Apple hasn't detailed the specifics of how all this works yet, but has said it uses similar security to the rest of iOS. Since iOS 7, Apple has done an incredible job with security and cryptograph. I'm willing to bet Extensibility is enjoying something just as well thought out and just as secure.

Bottom line


What's most impressive about Extensibility in general and widgets in specific is that Apple has set them up to work the same in both OS X and iOS. That involved a lot more work on their part — shortcuts for one system or the other couldn't be exploited — but ultimately consistency is a feature, and that discipline has resulted in a more unified, better framework for both developers and customers.

It's taken a long time for custom widgets to arrive on iOS, but there's every indication Apple has done them in the right way and put them in the right place.

Will you be using them? And if so, any particular third-party widgets you're most looking forward to?

f77b3c2b7726dd643c3eff0c1a15f1a6.gif


57cc2e5db515795d3a5df81768876414._.png
a29f2011bdaa2f81c96617e302e63e42._.png
520ba4b1f4a69dab422acfabfacaca5d._.png

2f851f979c069364c8e30502acd56a1d._.gifd01613600c4b4ebd7f60f125daefcdac._.gif495f1097280d84c2dceca4df13c10636._.gif

Continue reading...
 
Back
Top