Wider haptics control with iOS 13’s UIImpactFeedbackGenerator

Quietly slipped into iOS 13 and in classic Apple fashion, the expanded documentation for UIImpactFeedbackGenerator’s new styles and impactOccurred(intensity:) say “No overview available.” but being one of my favorite things for iPhone and waiting a long time for this, I did a little research into what’s capable with these new APIs.

To me, it looks like Apple has completely opened the haptic engine feedback to any feedback you’d like. This is particularly great for games, since now you can control the feedback weight of characters and objects (and the way I discovered this slipped in).

UIImpactFeedbackGenerator.FeedbackStyle

There are two new styles added to FeedbackStyle, Rigid and Soft and both are pretty distinct. Rigid is a quick tap which is very sharp while the soft behavior is more mushy, a reminder of how phone vibration engines were prior to their focus on the Taptic Engine line.

impactOccurred(intensity: CGFloat)

This is the gem of the new APIs. Using the float, you can basically choose any level of weight to add to the impact. There isn’t any documentation on it, but in my testing, values as low as 0.3 and as high as 10000 where still distinct from each other. Beyond those thresholds it little bit more harder to determine difference, but overall this function allows for some incredibly precise values which helps create distinction between various elements in your designs and games.

Impact Testing

I went ahead and whipped together a a small project that demonstrates the different combination and levels that can be achieved.

It’s nothing more than simple set of toggles and weights applied to impactOccurred(intensity: CGFloat), but it helps to give you a feel of how to manipulate the feelings any much effort. Enjoy!

Download Now

I am Dan Griffin and you can find me on Mastodon

The Blog

Base & Elevated System (and Grouped!) Background Colors

In iOS 13, Apple introduced a slew of new colors that are also dynamic – meaning they will adjust between light and dark modes (and other scenarios, such as high contrast). Of the new colors, the various background colors are pretty pecular: iOS defines two sets of background colors—system and grouped—each of which contains primary,…

iOS iOS 13

Always Taking Inquiries

At the moment I am not taking on many new projects, but am still available for inquiry or questions.

Reach Out To Dan