0

In the settings of accessibility of the iphone we can activate or not the option of "shake to cancel". I would like to know if it is possible in swift to know if the setting is activated or not. thank you

pilou
  • 75
  • 1
  • 7

1 Answers1

1

From Apple docs:

UIAccessibility.isShakeToUndoEnabled

There's also a NSNotification sent when this setting is changed called shakeToUndoDidChangeNotification.

Silis Alin
  • 140
  • 2
  • 13
  • Thanks. Can you show me an example for shakeToUndoDidChangeNotification please ? I don't understand. – pilou Apr 26 '21 at 13:35
  • You need to use `NotificationCenter` to receive updates. [This SO thread](https://stackoverflow.com/questions/24049020/nsnotificationcenter-addobserver-in-swift) should prove useful. – Silis Alin Apr 26 '21 at 14:23