Six amazing features on the BlaBlaCar iOS app explained
How we improve our app with hidden features, from Victor Carmouze and Charlotte Martin
With every update for the iPhone or iPad, Apple adds new features in addition to bug fixes and performance improvements. Besides the most popular features, some less visible additions are introduced each year.
From a developer perspective, we should make sure those features are well handled, as much as we want to implement the most known ones.
We believe that it’s the small details that distinguish your application from others.
In this article, we will focus on those hidden features. We will show you why they serve our product and how you can implement them.
Spotlight
Spotlight is the iOS system-wide search feature. By default, it enables the user to search for multiple things such as apps, contacts or messages. Starting from iOS 9, Apple allowed us to index our custom data in order to appear in the results.
How to implement it
You can do it with the CoreSpotlight framework.
Index Data
Decide the data you want to index which can contain an id, title, description or image. In our app, we could for example index a trip using its id, departure, destination, departure date and an avatar image. Spotlight will be able to find our trip if the user searches for any of these data.
Expiration date
You can also add an expiration date to each indexed trip. Once you reach this date, the data will be deleted and won’t be returned to the users during their next spotlight search. For example, in our case, this date would be the day after a trip’s departure.
When you index your data, you need to:
- Create a CSSearchableItemAttributeSet which will contain all the keywords listed
- Index all those attributes
Handle tap on result
By default, a tap on a result will open the application. You can customize that behaviour and open a specific screen of the application using:
A user would appreciate to search for a ride to get details or to search for a passenger of his upcoming trip.
We were exploring this feature earlier this year, hoping that it will soon be released!
Widgets
Widgets are one of the most popular features introduced in iOS 14. Thanks to them, users can see key content of our application directly on their home screen.
In our case, it will allow members to quickly access the details of their upcoming trips.
How to implement it
First of all, note that you must use SwiftUI to work with WidgetKit. UIKit is not compatible.
Initialize your widget
To initialize a widget, you need to build its WidgetConfiguration by providing several pieces of information.
- A unique identifier string that describes your widget.
A TimelineProvider. It is composed of TimeLineEntries and a reload policy (never, after a date, …).
TimeLineEntry
Each TimeLineEntry contains the data you will use to build your view and a date.
When the timeline reaches the date of a specific TimeLineEntry, the WidgetConfiguration that asked for this timeline will emit the associated Entry in the content closure, in order to build the widget’s view from this entry.
Here are some examples of some properties you can set to configure your widget:
- configurationDisplayName is the name displayed to the user
- description is the description displayed to the user.
- supportedFamilies is the size that the widget can handle. It can be systemSmall, systemMedium or systemLarge.
Small tip: while you are loading real content to display within your widget, you can display temporary placeholder content. You can do this by implementing:
func placeholder(in context: Context) -> Entry
Don’t forget to declare your widgets, you can do it in a struct that implements WidgetBundle protocol :
That way, our members will be able to search for a trip and find all information needed for their next trip at a glance without launching the app. We are already working on it, widgets will come very soon!
Haptic touch
When Apple introduced 3D touch back in iOS 9, we got the possibility to handle force touch events on the screen. They introduced use cases for this hardware feature, such as drawing, peek and pop gestures or shortcuts directly on the home screen.
Today Apple is removing force touch on the iPhone as much as on the watch. Related API are deprecated since iOS 13 and have been replaced by Haptic Touch APIs.
We use them at several places in the app so users can benefit from it and our app adopts one more native iOS feature.
On the home screen
In order to offer a new way to navigate faster to our main features, we added shortcuts on the home screen.
We use new iOS 13 APIs to support Quick Actions.
How to implement it
As our product doesn’t need any dynamic shortcut that changes depending on the context, we can directly add them in our Info.plist as an array of UIApplicationShortcutItem.
With the full list of parameters here :
Next, you need to implement this method from the UISceneDelegate:
From the shortcutItem’s identifier, you can retrieve the shortcut which has been produced by the user and perform your action
Several improvements are possible, like dynamic shortcuts, custom icons, subtitles, etc…
On our search result screen
Peek and Pop gestures are widely implemented through native apple apps. For example, on Safari when you long press a link, you get a preview.
They can be added to yours too. In our case, on the search page, when we long press a result, we display a preview of the next screen.
How to implement it
In this example, we will focus on a tableView. In our case, we had to implement the following method of UITableViewDelegate protocol:
func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? {}
This method asks us to return an UIContextMenuConfiguration which needs three arguments.
1- An index path, which will be useful for retrieving the data associated with it.
2- A previewViewController, which will show a part of your next screen.
A good idea is to customize the preview controller and optimise it for this type of experience. At least remove navigation items.
3- And last, a set of quick actions (UIAction), which will fit under the preview. Choose shortcuts that make users save time, otherwise there is no point using them.
You can of course customize the actions thanks to the indexPath we saw earlier, depending on the cell, or the next content. It’s always nice to see dynamic behaviours in our app.
In the BlaBlaCar application, it can be time consuming to find the detail you are looking for about a trip. This is why we have introduced this feature in the search result page. In the next example, it’s possible to quickly navigate to the driver’s profile
Long press on back button
iOS 14 introduced new back behaviors, allowing to go multiple steps back at once by long pressing the back button.
In our BlaBlaCar application case, it is very useful in the Publication Flow when the driver wants to go back to a specific screen of the form.
How to implement it
We get this feature for free with the latest iOS 14 release.
If you have already filled the title property of your viewController, you don’t have to do anything, the title value will automatically be displayed.
If you want to override this value, you can use this property:
navigationItem.backButtonTitle
Notifications
Notifications is one of the most used features in iOS. So it’s certainly a good reason to spend some extra work on it. And since iOS 10 we can do this with notifications extensions.
The simplest way to interact with a notification is to touch it. It will open your app, or a deep link, and that’s it.
You can also attach to your notifications quick actions (mute a messenger conversion, accept or decline an invitation in a calendar app, …)
And finally, with notification extensions, you can add a new level of information. When you pull down or long touch your notification, you can display additional information.
From that point, you are free to develop any kind of notification. You can show a picture, add some context or information and even, since iOS 12, interactive actions right inside your notification.
In the BlaBlaCar application point of view, we have imagined some examples which could be useful when we will decide to put them in production. Here comes three different types of notifications to show their potential.
- Use the canvas to show full information about someone who wants to join your carpool
- Directly reply to a message from our internal chat.
- Rate a driver/carpooler after your ride directly from the notification, without the need of opening the app
How to implement it
First, you need to create a Notification Service Extension. In this extension you will have three files:
- A NotificationViewController, which will be the viewController displayed by your notification
- A storyboard you may want to use or not
- An info.plist, which focuses on notification configuration, like its ratio or activate the possibility to interact with rich content
Your ViewController must implement UNNotificationContentExtension. It consists of implementing:
func didReceive(_ notification: UNNotification) { }
With this UNNotification parameter, you can retrieve information about your notification. This information will enable you to populate your ViewController.
Don’t take too long to render your ViewController if you don’t want your extension to be killed by iOS.
If you want your rich content to be displayed, your notification payload must set its mutable-content property to 1 so the system passes the notification to your notification service app extension.
One last tip! To test your notification, you can simply drag its payload directly onto the simulator!
Conclusion
One of the advantages of having a native app is that we get full and easy access to those kinds of features and we should benefit from them. Some of them need some time, but others can be really easy to implement.
We spoke about extensions we’ve been working on, but there are lots of others you can use, like Siri or iMessage apps.
At BlaBlaCar, we will continue trying to improve user experience in our app. We are always willing to explore new features we could add and get feedback from our power users about them!
Don’t hesitate to share with us what features do you think are the most compelling or worth seeing!
Special thanks to Thomas Salandre, Emilie Baliozian and the iOS chapter at BlaBlaCar who helped us review this article.