At the iOS 9 WWDC, Apple introduced several useful features in its Search APIs. Going well beyond “find this text,” this set of SDKs helps developers provide their users with better in-app content using Spotlight, Handoff, and Siri Suggestions.
Most applications – at least those with any meaningful amount of data gathering – need some way for users to find data. Users can search for specific terms, such as “spaghetti recipe” or “Greek restaurants,” when the app stores or curates the data. But few users “live” in a single mobile app. We all switch from one thing to another: from an appointment calendar to maps (how do I get to that appointment) to a restaurant-finder (for lunch after the appointment) to a fitness app (to work off the calories from that lunch). That expands the understanding of search: Users want their phones to make guesses – good ones – about what they want to do next.
In an effort to aggregate search across the iOS user experience, iOS 9 introduced proactive suggestions, which were subsequently enhanced in iOS 10. Apple describes the goal of proactive suggestions as to:
- “…provide information about what users do in your app, which helps the system promote your app in additional places, such as the keyboard with QuickType suggestions, Maps and CarPlay, the app switcher, Siri interactions, and (for media playing apps) the lock screen.” (source: Apple Developer Documentation).
In this article, I explain the role of proactive suggestions and give an overview of how to implement them in your iOS apps.
What Are Proactive Suggestions?
First, a bit of context. In iOS, handoff works by handing off application context from one device to another. For example, a user may look at a calendar event on her iPhone, then switch attention to her MacBook. With the help of handoff, she can seamlessly view that same event on the Calendar application on her computer.
In contrast, rather than work between devices, proactive suggestions hand off data and processes contextually between different apps on the same device. Doing so makes application boundaries less relevant in favor of the user’s functional intentions.
Proactive suggestions include both suggestions and queues. Its aim is to intelligently present relevant information at the most appropriate of times, and have apps work in orchestration based on the user’s function. Proactive suggestions help developers make their apps more engaging with little effort on their part. Users now need to only consider the function and service they want, rather than work out which app they ought to launch.
Let’s imagine a scenario where the user sees a benefit:
- Sally is on the lookout for a nice Mexican restaurant in San Francisco. She opens up Yelp, and finds a restaurant she likes in the Mission district. Sally then switches to the Maps app, which, in anticipation of Sally’s next move, already grabbed the restaurant’s address as a suggestion. The algorithmic assumption is that the user most likely wants to navigate to that restaurant. In Sally’s case, she wants to see where the restaurant is relative to where she lives.
- Sally’s sold (those enchiladas sound delicious!), so she decides to tell her friends to meet there for dinner tonight. She switches to the Messages app to send texts to her group. The Messages app proactively offers suggestion text including the restaurant’s address (using QuickType), to make it easier for her to share on the group text message.
- After everyone agrees with Sally’s restaurant choice, she opens the Uber app. Since Uber is programmed to take advantage of proactive suggestions, it contextually understands that Sally (likely) wants to ride-share to the location; it pre-populates (or suggests) the address of the restaurant in the destination field.
Ready to get started? Here’s an overview of the steps to implement proactive suggestions:
- Set up the app for proactive suggestions
- Integrate with Spotlight Search
- Incorporate Location suggestions
- Implementing QuickType suggestions
- Integrate with Contacts
Set up the app for proactive suggestions
The first task is to give the operating system some information about an app, signaling that the app is available for hand-off to other apps. This is accomplished using NSUserActivity, an integral API with which iOS developers should familiarize themselves. Part of iOS’s core foundational framework, NSUserActivity was first introduced in iOS 8 to enable provide developers with access to Handoff.