Your graphics all exist in an AGSGraphicsOverlay. You can get the graphics overlay's extent and use mapView.setViewpointGeometry() to set the extent.
Something like this:
mapView.setViewpointGeometry(graphicsOverlay.extent, completion: nil)
or to add a few pixels padding at the edge of your map…
mapView.setViewpointGeometry(graphicsOverlay.extent, padding: 30, completion: nil)
Note that both of those will animate to the extent of the graphics in the overlay. If there are no graphics in the overlay, nothing will happen (you may see a trapped error in your console log).
If you don't want to animate, you must create a viewpoint and set the viewpoint explicitly using the non-animating setViewpoint() method (you can tell it's non-animating because it doesn't have a completion callback block parameter)…
mapView.setViewpoint(AGSViewpoint(targetExtent: graphicsOverlay.extent))
The above dynamic extent property is a convenience when working with AGSGraphicsOverlays. You could also use the all-powerful AGSGeometryEngine to get the combined extent of all the graphics' geometries and set the viewpoint to that…
if let extent = AGSGeometryEngine.combineExtents(ofGeometries: graphicsOverlay.graphics.compactMap({ ($0 as! AGSGraphic).geometry })) {
mapView.setViewpointGeometry(extent, padding: 30, completion: nil)
}
Hope this helps.