MKGeoJSONDecoder and Single Points

https://developer.apple.com/documentation/mapkit/mkgeojsondecoder?changes=__9&language=objc

I am trying to use this decoder to obtain single points form a geojson file. I am able to do this successfully however, when using MapKit for iOS 17+ I am unable to use a ForEach to iterate through these points (stored in an array) and display these on the map as a custom annotation or even a marker.

                    MapAnnotation(coordinate: point.coordinate) {
                        VStack {
                            Image(systemName: "mappin.circle.fill")
                                .resizable()
                                .frame(width: 25, height: 25)
                                .foregroundColor(.purple)
                            if let title = point.title {
                                Text(title)
                                    .font(.caption)
                                    .foregroundColor(.purple)
                                    .padding(2)
                                    .background(Color.white.opacity(0.8))
                                    .cornerRadius(3)
                            }
                        }
                    }

Could we see a small, buildable test project with your GeoJSON file, and also the MapKit code to load and display it? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

— Ed Ford,  DTS Engineer

MKGeoJSONDecoder and Single Points
 
 
Q