How to take screenshot of the ArcGIS map in SwiftUI sdk.
Hello!
Thanks for the question and good news, we have a way of doing that. You can use the MapViewReader to access the proxy which has operations for the MapView. And on that proxy we have a method to export an image of the current map. Like this:
var body: some View {
MapViewReader { proxy in
MapView(map: map)
.task {
// This will export the image when the view appears
// but I recommend putting this code where you want
// to take the screenshot.
let screenshot = try? await proxy.exportImage()
}
}
}
Thank you for your reply, I am working on a exporting function from the mapview or tilelayer image , which is the, I also research the api document from esri , find there is no other better way to perform this function .