Search code examples
swiftskmapsskviapoint

How to create an array of SKViaPoint in swift - Skobbler API


I want to calculate a route with several viaPoints.

    let route = SKRouteSettings()
    route.startCoordinate = self.userLocation
    route.destinationCoordinate = endCheckpoint.location.coordinate
    route.viaPoints = viaPointsArray
    SKRoutingService.sharedInstance().calculateRoute(route)

But I cannot declare SKViaPoint. Class declaration seems to be missing as I'm getting "Use of unresolved identifier 'SKViaPoint' when I try to declare a variable"

Is there something i'm missing? I remember when I was working in Objective C, that I needed to import SKViaPoint.h specifically this is the old question about it

So what should I do in swift?


Solution

  • The Swift implementation is missing some imports (SKViaPoint being one of them).

    See this questions for a fix