How Instagram Tied its Infrastructure to Apple’s 3D Touch API

The release of the Apple iPhone 6s saw the launch of a new feature called 3D Touch that measures the pressure changes when you firmly press the screen. In a recent case study for Instagram Engineering, Ryan Nystrom discussed how Instagram leveraged the 3 associated APIs to bring new features to Instagram.

The first API, Quick Actions, gave the team the opportunity to assign four common actions to the home screen logo when pressed hard. These options, covering Search, Direct, Activity and Creation, act as shortcuts that take you straight to that feature. These options were added to the home screen simply by creating an array of UIApplicationShortcutItems and adding them to the app’s delegate.

Peek and Pop is a way to quickly get a closer look at content, in this case an image thumbnail in the home Feed, without committing to the content download. The delegate UIViewControllerPreviewDelegate in Instagram registers the view of a controller that can receive touches. When a 3D Touch occurs, the delegate decides if there is an associated view, and if so, it sets the source rect of the target view and returns a controller to present that view. Instagram integrated this feature seamlessly with the existing view and infrastructure, making it a powerful feature addition.

The third API gives developer details about the depth of a 3D Touch for configuring the related controllers, and Instagram has used a combination of all three APIs to enhance User Experience by adding more features while keeping the interface quick and simple to use.

Be sure to read the next API Design article: How to Invoke the Uber API from the Server Using JavaScript,

Original Article

Lessons learned with 3D Touch