[swift] add MKUserTrackingBarButtonItem to UINavigationItem

@IBOutlet var navigationBar: UINavigationItem!

이렇게 연결을 해둔다음에

 

let currentLocationItem = MKUserTrackingBarButtonItem.init(mapView: mapView)
navigationBar.setRightBarButtonItem(currentLocationItem, animated: true)
currentLocationItem.performSelector(currentLocationItem.action) // force click

라고 호출하면 된다.

 

screenshot 2