Adding dynamism with UIKit Dynamics

Most apps implement simple animations, like the ones you saw in the last couple of sections. However, some animations might need even more realism. This is what UIKit Dynamics is for. With UIKit Dynamics, you can place one or more views in a scene that uses a physics engine to apply certain forces to the views it contains. For instance, you can apply gravity to a particular object, causing it to fall off the screen. You can even have objects bumping into each other, and if you assign a mass to your views, this mass is taken into account when two objects crash into each other. When you apply a certain force to an object with very little mass, it will be displaced more than an object with a lot of mass, just ...

Get Mastering iOS 12 Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.