From 64c5d31fbffd4f5ffdb30dedc5e9a7e5e7b0d993 Mon Sep 17 00:00:00 2001 From: polymonster Date: Sun, 14 Jan 2024 17:46:07 +0000 Subject: [PATCH] - add haptic selection api --- core/pen/include/os.h | 1 + core/pen/source/ios/os.mm | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/core/pen/include/os.h b/core/pen/include/os.h index 43c3cbe9..0725155d 100644 --- a/core/pen/include/os.h +++ b/core/pen/include/os.h @@ -47,6 +47,7 @@ namespace pen void os_open_url(const Str& url); void os_ignore_slient(); f32 os_get_status_bar_portrait_height(); + void os_haptic_selection_feedback(); // music struct music_item diff --git a/core/pen/source/ios/os.mm b/core/pen/source/ios/os.mm index ef1e0086..5c73f337 100644 --- a/core/pen/source/ios/os.mm +++ b/core/pen/source/ios/os.mm @@ -433,4 +433,14 @@ f32 os_get_status_bar_portrait_height() CGFloat s = [[UIScreen mainScreen] scale]; return (f32)h*s; } + + void os_haptic_selection_feedback() + { + @autoreleasepool { + auto generator = [[UISelectionFeedbackGenerator alloc] init]; + [generator prepare]; + [generator selectionChanged]; + [generator release]; + } + } }