efremidze / haptica Goto Github PK
View Code? Open in Web Editor NEWEasy Haptic Feedback Generator ๐ณ
License: MIT License
Easy Haptic Feedback Generator ๐ณ
License: MIT License
Just wondering is there a max length on the custom string haptic? If so is it a sytem thing or is it limited by the pod itself?
Update to 4.2 please.
Title says it all.
Thanks!
I am using Haptica in my app I recently release a new version of my app on 16 July after that repeating crashes are reported on Xcode organiser. Below are the exception details:-
ERROR: -[_UIFeedbackHapticOnlyEngine _deactivate] called more times than the feedback engine was activated
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x1f7bc927c __exceptionPreprocess
1 libobjc.A.dylib 0x1f6da39f8 objc_exception_throw
2 CoreFoundation 0x1f7ae2988 +[_CFXNotificationTokenRegistration keyCallbacks]
3 Foundation 0x1f85a6188 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
4 UIKitCore 0x224055628 -[_UIFeedbackEngine _deactivate]
5 UIKitCore 0x22403e58c -[UIFeedbackGenerator __deactivateWithStyle:]
6 libdispatch.dylib 0x1f7608a38 _dispatch_call_block_and_release
7 libdispatch.dylib 0x1f76097d4 _dispatch_client_callout
8 libdispatch.dylib 0x1f75b7004 _dispatch_main_queue_callback_4CF$VARIANT$mp
9 CoreFoundation 0x1f7b5ac1c CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
10 CoreFoundation 0x1f7b55b54 __CFRunLoopRun
11 CoreFoundation 0x1f7b550b0 CFRunLoopRunSpecific
12 GraphicsServices 0x1f9d5579c GSEventRunModal
13 UIKitCore 0x2244cf978 UIApplicationMain
14 Qpay 0x102253268 main + 16 (GeneratePasscodeInteractor.swift:16)
15 libdyld.dylib 0x1f761a8e0 start
Haptica version:- 3.0.0
Thanks
Sometimes feedback stops working until I restart the device. Any idea as to why this issue may be happening?
Has anyone figured out the fireworks sequence and/or is there a collection of sequences out there to reuse?
There is no real issue and this topic is more of an observation type.
Q.1:
I used Haptica as:
button.isHaptic = true // required call.
button.hapticType = .impact(.light) // optional, but has to be set.
button.hapticControlEvents = .touchUpInside // optional, default is .touchDown as per implementation.
My initialization logic has a flaw since button.isHaptic = true immediately triggers a call to addTarget() with .touchDown as default value (if hapticControlEvents is not set).
Hence hapticControlEvents should be initialized before button.isHaptic = true invocation to make any effect.
Would this make sense to refactor and introduce methods like these:
func addHaptic(_ haptic: Haptic, forControlEvents events: UIControl.Event = .touchUpInside)
func removeHaptic()
to enable 1 line setup?
Methods naming strategy 'addHaptic', 'removeHaptic' stolen from 'addTarget', 'removeTarget'.
Q.2:
Does it make sense to implement Hapticable for UIControl rather than UIButton? (since addTarget and removeTargets methods implemented in UIControl).
This would enable Haptics for elements like UISwitch.
There is only few options to configure a haptic button, it would be great if we can do it directly in StoryBoard inspector.
As the technology for haptic feedback evolves, new syntax and methods are introduced to improve performance and expand capabilities. It has come to my attention that this repository's implementation of haptic feedback may be outdated. Updating to the latest syntax can enhance the user experience, provide more precise control over feedback, and ensure compatibility with the newest devices.
I recommend updating the haptic feedback implementation to utilize the latest syntax introduced in [specific version or framework name, if applicable]. This update can bring several improvements:
Here are a few examples of the changes in syntax from the current implementation to the proposed one:
These examples illustrate how the new syntax can provide clearer, more concise code and better control over haptic feedback.
Thanks for this great library!
I'm trying to use it in a table view, and I have the following code:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
Haptic.impact(.medium).generate()
// Other stuff...
}
This generates haptic feedback, but sometimes it seems to be generating two very fast consecutive ones. It happens when you click on one cell and then another.
Is it the wrong way to use the library? Thank you!
I tried with the following pattern but nothing simulates a double tap, how do I do that?
addButton(pattern: "O")
addButton(pattern: "o")
addButton(pattern: ".")
addButton(pattern: ".-.")
addButton(pattern: "o-o")
addButton(pattern: "O-O")
addButton(pattern: "..oO-Oo..")
addButton(pattern: "O--O")
addButton(pattern: "o--o")
addButton(pattern: "o---o")
addButton(pattern: "O---O")
addButton(pattern: "o--O--O--o")
addButton(pattern: "o--O---O--o")
addButton(pattern: "O--O---O--O")
addButton(pattern: "OOO------------------------OOO")
How to stop while playing a long pattern
Haptic.play("OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO", delay: 0.1)
I want to stop this when this is playing. Please show me a way to do it.
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.