Solution of intensity configurable vibrations.
-
The key is to use
UIImpactFeedbackGenerator
.My demo:
import objc_util, time feedback = objc_util.ObjCClass('UIImpactFeedbackGenerator').new() feedback.initWithStyle(0) for I in range(0, 9): feedback.impactOccurred() time.sleep(0.1)
This demo will generate "impact feedback" with rhythm.
Another way is to use
AudioToolbox.h
C API. I learned from this topic, but I found another system sound IDs to perform different intensities.AudioServicesPlaySystemSound(1519); AudioServicesPlaySystemSound(1520); AudioServicesPlaySystemSound(1521);
Where
1519
and1520
are the same feedbacks when you use 3D touch,1521
is a 3 combo light vibrate.
-
This post is deleted!last edited by
-
That worked for me as well!