Animated images
Pause animations in animated images in your app when people turn off the Animated Images setting.
Overview
People use the Animated Images setting to control whether to play animated images like GIFs on the web and in apps. By default, the setting is on, which allows animated images to play automatically. A person can turn off the setting to indicate that they want to pause animated images on their device.
In your app, handle changes to the Animated Images setting to create an enjoyable experience for people who choose to pause animated images. Register for the notification animatedImagesEnabledDidChangeNotification to respond to changes in this setting:
import Accessibility
NotificationCenter.default.addObserver(self,
selector: #selector(animatedImagesChanged),
name: NSNotification.Name.animatedImagesEnabledDidChangeNotification,
object: nil)When the Animated Images setting changes, perform changes to your UI to pause animated images:
@objc
func animatedImagesChanged(_ notification: Notification) {
if AccessibilitySettings.animatedImagesEnabled {
// The setting is on. Animate images.
} else {
// The setting is off. Pause animations in animated images.
}
}Check the value of the Animated Images setting at any time by using animatedImagesEnabled.