shakebugs / shake-ios

Bug and crash reporting SDK for iOS apps.
https://shakebugs.com
Other
30 stars 4 forks source link

SwiftUI support #11

Closed kutakmir closed 1 year ago

kutakmir commented 3 years ago

Hi, are you planning to support SwiftUI apps?

Temporary solution:

extension NSNotification.Name {
    public static let deviceDidShakeNotification = NSNotification.Name("MyDeviceDidShakeNotification")
}

extension UIWindow {
    open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
        super.motionEnded(motion, with: event)
        NotificationCenter.default.post(name: .deviceDidShakeNotification, object: event)
    }
}

Source: https://stackoverflow.com/questions/58549151/how-to-detect-shake-gesture-in-swiftui

and

.onReceive(NotificationCenter.default.publisher(for: .deviceDidShakeNotification)) { _ in
            Shake.show()
        }
david-halapir commented 3 years ago

Hi @kutakmir ,

Thanks for the report. Yes, we are planning to support SwiftUI, guess this went under the radar. Adding this issue to backlog so expect it fixed in one of the upcoming releases.

David,

Shake Team