has the drawStatusChangedHandler block been removed at 100? thanks
Solved! Go to Solution.
It has been removed in favor of KVO on the `drawStatus` property:
```
import UIKit
import ArcGIS
private var myKVOContext = 0
class ViewController: UIViewController {
let mapView = AGSMapView(frame: CGRect.zero)
override func viewDidLoad() {
super.viewDidLoad()
mapView.frame = view.bounds
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(mapView)
mapView.map = AGSMap(basemapType: .streets, latitude: 0, longitude: 0, levelOfDetail: 0)
mapView.addObserver(self, forKeyPath: "drawStatus", options: .new, context: &myKVOContext)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if context == &myKVOContext{
if keyPath == "drawStatus"{
print("drawStatus changed: \(mapView.drawStatus.rawValue)")
}
}
else{
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
}
}
}
```
It has been removed in favor of KVO on the `drawStatus` property:
```
import UIKit
import ArcGIS
private var myKVOContext = 0
class ViewController: UIViewController {
let mapView = AGSMapView(frame: CGRect.zero)
override func viewDidLoad() {
super.viewDidLoad()
mapView.frame = view.bounds
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(mapView)
mapView.map = AGSMap(basemapType: .streets, latitude: 0, longitude: 0, levelOfDetail: 0)
mapView.addObserver(self, forKeyPath: "drawStatus", options: .new, context: &myKVOContext)
}
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if context == &myKVOContext{
if keyPath == "drawStatus"{
print("drawStatus changed: \(mapView.drawStatus.rawValue)")
}
}
else{
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
}
}
}
```
thank you, works as expected
Brian,
If your going to be using KVO much, check out Facebook's KVOController library:
https://github.com/facebook/KVOController
It's block based API makes wiring up KVO events much cleaner in code.
Cheers,
James
thanks james, I'll take a look