But everything returns an error...
Can any one help me, please?
Where can I find an explanation of swift syntax?
A few more comments: when you have error, please post the error
what you tried:
let map = MKMapView(.mapType = .hybridFlyover )
is a wrong syntax, as you have noticed.
When you call a class initialiser that has parameters, it would be something like this syntax:
let map = MKMapView(mapType: .hybridFlyover)
No dot before the label for the parameter
no equal but colon sign
But this does not work here because no such initialiser exist (you could subclass MKMapView and create such a convenience init)
This works:
import MapKit
class MyOwnMKMapView : MKMapView {
convenience init(mapType: MKMapType) {
self.init()
self.mapType = mapType
}
}
class KMLViewerViewController: UIViewController, MKMapViewDelegate {
let map = MyOwnMKMapView(mapType : .hybridFlyover ) // You use your subclass
// etc. ...
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: