I have tried to make colored annotations in mapView (shown in the commented sections) but they always appear in black. Any help would be appreciated.
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "TempAnnotationView")
annotationView.canShowCallout = true
annotationView.rightCalloutAccessoryView = UIButton(type: .detailDisclosure)
let configuration = UIImage.SymbolConfiguration(pointSize: 10, weight: .thin, scale: .default)
if annotation.title == "Start" {
// let config = UIImage.SymbolConfiguration.preferringMulticolor()
// let image = UIImage(systemName: "flag.fill", withConfiguration: config)
// // palette
// let config2 = UIImage.SymbolConfiguration(paletteColors: [.systemRed, .systemGreen, .systemBlue])
// let image2 = UIImage(systemName: "person.3.sequence.fill", withConfiguration: config2)
// // hierarchical symbols
// let config3 = UIImage.SymbolConfiguration(hierarchicalColor: .systemIndigo)
// let image3 = UIImage(systemName: "square.stack.3d.down.right.fill", withConfiguration: config3)
// // color
// let image4 = UIImage(systemName: "cone.fill")?.withTintColor(.systemRed, renderingMode: .alwaysTemplate)
// annotationView.image = image4
annotationView.image = UIImage(systemName: "poweron", withConfiguration: configuration)
}
return annotationView
}