Skip to content

Commit

Permalink
fixed coremotion crash
Browse files Browse the repository at this point in the history
  • Loading branch information
bpisano committed Dec 24, 2024
1 parent 97c3db1 commit 6561449
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ private struct WithAccelerometerViewModifier<ModifiedContent: View>: ViewModifie
let makeView: (AnyView, AccelerometerAttitude) -> ModifiedContent

private let motionManager = CMMotionManager()
private let queue = OperationQueue()

@State private var attitude: AccelerometerAttitude = .init()
@State private var referenceAttitude: AccelerometerAttitude?
Expand All @@ -32,7 +31,7 @@ private struct WithAccelerometerViewModifier<ModifiedContent: View>: ViewModifie
private func startMotionUpdates() {
guard motionManager.isDeviceMotionAvailable else { return }
motionManager.deviceMotionUpdateInterval = updateInterval
motionManager.startDeviceMotionUpdates(to: queue) { motion, error in
motionManager.startDeviceMotionUpdates(to: .main) { motion, error in
guard let motion = motion, error == nil else { return }
var currentAttitude: AccelerometerAttitude = .init(attitude: motion.attitude)

Expand Down

0 comments on commit 6561449

Please sign in to comment.