Reading time: 5 min
This recipe shows how to detect when touch enters or exits your view. It shows how to do this for for two scenarios:
- Detect enter/exit in a single view.
- Detect enter/exit on a group of views, all sharing a single gesture.
The end results look like this:
Detecting Enter and Exit on...
Reading time: 4 min
This recipe shows how to zoom an image in SwiftUI using the pinch/magnify gesture. The image is zoomed in or out at the midpoint between the fingers, supports dragging and double tap to zoom in or reset. The end result looks like this:
The recipe goes as follows:
- Use a custom
Reading time: 1 min
This recipe shows how to implement shake gesture detection in SwiftUI. The result looks like this (you'll have to image the phone being shaken :)):
This component is available as a Swift Package in this repo.
The recipe is as follows:
Reading time: 3 min
This recipe shows how to implement a swipeable pager view in SwiftUI. The end result will look like this:
A pager view lays its child views out as pages - single, currently selected child view occupies the entire pager. The user can swipe left or right to move through different pages.