I write an app in Swift and is bridging some Objective-C code. One of these classes has a method that looks like this: + (CLLocationCoordinate2D *)polylineWithEncodedString:(NSString *)encodedString;
.
In Swift, it said this method returns a UnsafeMutablePointer<CLLocationCoordinate2D>
. What I want is a Swift array of CLLocationCoordinate2D
.
What obviously doesn't work, but I tried, is this:
let coordinates: [CLLocationCoordinate2D] = TheClass.polylineWithEncodedString(encodedString)
which will give me the following error:
'UnsafeMutablePointer<CLLocationCoordinate2D>' is not convertible to '[CLLocationCoordinate2D]'
Is it somehow possible to convert this UnsafeMutablePointer<CLLocationCoordinate2D>
to a [CLLocationCoordinate2D]
? Or should I take a different approach?