C サイズの配列を使用していた関数を迅速に操作するにはどうすればよいですか?
Interacting with C APISを読みましたが、まだこれを理解できません。
状態の coords パラメーターのドキュメントfunc getCoordinates(_ coords:UnsafeMutablePointer<CLLocationCoordinate2D>,range range: NSRange)
:
私はいくつかのことを試しましたが、最近では:
var coordinates: UnsafeMutablePointer<CLLocationCoordinate2D> = nil
polyline.getCoordinates(&coordinates, range: NSMakeRange(0, polyline.pointCount))
次のようなものを使用する必要がありますか?
var coordinates = UnsafeMutablePointer<CLLocationCoordinate2D>(calloc(1, UInt(polyline.pointCount)))
ここで髪を引っ張ります... 何か考えはありますか?