如何将 NSValue 转换为 CLLocationCoordinate2D

How to Convert NSValue to CLLocationCoordinate2D

如何将NSValue转换成CLLocationCoordinate2D

我在 (NSArray *)coordinateArray 中收到 NSValue 并且需要为数组中的每个 NSValue 获取 CLLocationCoordinate2D

Obj-C

#import <MapKit/MKGeometry.h> 

NSValue *coordinateValue; 
CLLocationCoordinate2D coordinate = [coordinateValue MKCoordinateValue];

Swift 4.x

let coordinateValue: NSValue = NSValue.init()
let coordinate: CLLocationCoordinate2D = coordinateValue.mkCoordinateValue