支持 Carthage,添加以下代码到你的Cartfile文件中:
github "JackZhouCn/JZLocationConverter-Swift"
或
支持 CocoaPods,添加以下代码到你的Podfile文件中:
pod 'JZLocationConverterSwift'
1、在APP启动时加载大陆边境线数据:
//默认边境线数据
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
JZLocationConverter.start { (error) in
if error != nil {
print("失败")
}else {
print("成功")
}
}
return true
}
或者
//自定义边境线数据
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
JZLocationConverter.start(filePath: Bundle.main.path(forResource: "xx", ofType: "json")) { (error:JZFileError?) in
if error != nil {
print("失败")
}else {
print("成功")
}
}
return true
}
JZLocationConverter.default
public func wgs84ToGcj02(_ wgs84Point:CLLocationCoordinate2D,result:@escaping (_ gcj02Point:CLLocationCoordinate2D) -> Void)
public func gcj02ToWgs84(_ gcj02Point:CLLocationCoordinate2D,result:@escaping (_ wgs84Point:CLLocationCoordinate2D) -> Void)
public func wgs84ToBd09(_ wgs84Point:CLLocationCoordinate2D,result:@escaping (_ bd09Point:CLLocationCoordinate2D) -> Void)
public func bd09ToWgs84(_ bd09Point:CLLocationCoordinate2D,result:@escaping (_ wgs84Point:CLLocationCoordinate2D) -> Void)
public func gcj02ToBd09(_ gcj02Point:CLLocationCoordinate2D,result:@escaping (_ bd09Point:CLLocationCoordinate2D) -> Void)
public func bd09ToGcj02(_ bd09Point:CLLocationCoordinate2D,result:@escaping (_ gcj02Point:CLLocationCoordinate2D) -> Void)