I want to add an observer on zoom (Float) property of GMSMapView. I wonder if it is possible and how can I do it?
Asked
Active
Viewed 179 times
1 Answers
2
Here ya go :)
import RxSwift
import RxCocoa
extension GMSMapView {
public var rx_zoom: Observable<Float> {
return self.rx_observe(Float.self, "camera.zoom")
.filter { $0 != nil }
.map { $0! }
}
}
voilà !

Pham Hoan
- 2,107
- 2
- 20
- 34
-
Thank you for your answer. I thought that nobody would answer me and had to use KVO instead. But as I use RxSwift through the whole project this looks like more elegant solution :) – Marina Apr 20 '16 at 14:06
-
1Join RxSwift's slack channel :) You will get responses much faster and more accurate than that of stackoverflow :) – Pham Hoan Apr 20 '16 at 15:34