I'm building a mobile app using the Google Maps SDK for iOS and I'm trying to use the mobile device's gyroscope data to pan the camera around a panorama in Street View. I've setup a GMSPanoramaView and a GMSPanoramaCamera with initial positions. I'm using the method -updateCamera on GMSPanoramaView but am unable to smoothly pan across each panorama. If anyone has any idea how I can achieve this feature please let me know. Here is my code so far in the -viewDidLoad portion of my viewcontroller:
if manager.gyroAvailable {
let queue = NSOperationQueue.mainQueue()
manager.startGyroUpdatesToQueue(queue, withHandler: { (data, error) -> Void in
NSOperationQueue.mainQueue().addOperationWithBlock({ () -> Void in
// Update UI
let cameraUpdate = GMSPanoramaCameraUpdate.rotateBy((data?.rotationRate.x.radiansToDegrees)!)
self.panoView.updateCamera(cameraUpdate, animationDuration: 1)
})
})
}
Following code is working in swift 3