Haptic Feedback on iOS 10, iPhone 7 and Titanium SDK 6.0.0+
var win = Ti.UI.createWindow({
backgroundColor: "#fff"
});
var slider = Ti.UI.createSlider({
min: 0,
max: 100,
width: 200
});
var feedback = Ti.UI.iOS.createFeedbackGenerator({
type: Ti.UI.iOS.FEEDBACK_GENERATOR_TYPE_SELECTION
});
// Do a haptic feedback every 25 %
slider.addEventListener("change", function(e) {
if (e.value % 25 == 0 && [slider.min, slider.max].indexOf(e.value) === -1) {
feedback.prepare();
feedback.selectionChanged();
}
});
win.add(slider);
win.open();