Create your own CLPlacemark for RideIntent

I am trying to create a custom CLPlacemark using the Intents framework. I am importing "intents" at the beginning of the files.

I found this solution:

let waypointLocation = CLLocation(latitude: 50.00, longitude: 8.00)
let waypointName = "Some Name"

let w1 = CLPlacemark.init(location: waypointLocation,
                                      name: waypointName,
                                      postalAddress: nil)

      

Unfortunately, the above code gives me the following error message:

Ambiguous reference to init element (label :) '

Any ideas what's wrong?

Documentation:

+3


source to share


3 answers


By subclassing CLPlacemark, you can use the Intents init infrastructure protocol (location: name: postalAddress) .

Somewhere in your project:

class MyPlacemark: CLPlacemark {}

      



Your code to create custom CLPlacemark:

let placeLocation = CLLocation(latitude: 50.00, longitude: 8.00)
let placeName = "Some name"
let customPlacemark = MyPlacemark(location: w1Location, name: w1Name, postalAddress: nil)

      

+1


source


You need to use

init(location:name:postalAddress);

      



The placemarkWithLocation objective-C inference is not swift, so it throws this error message.

In the documentation, you will see the language selection on the right side. init(location:name:postalAddress

is the quick call you need to create a new placemark.

0


source


You can replace MKPlacemark instead, which provides a couple more initializers (found that at http://szulctomasz.com/2015/07/01/ios-unit-testing-in-swift-and-clplacemark-mocking.html )

0


source







All Articles