func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
if let land = style.layer(withIdentifier: "land") {
let canvas = MGLBackgroundStyleLayer(identifier: "canvas")
//canvas.backgroundColor = NSExpression(forConstantValue: UIColor.yellow)
canvas.backgroundOpacity = NSExpression(forConstantValue: 1.0)
canvas.backgroundPattern = NSExpression(forConstantValue: "customTile")
//canvas.backgroundPattern = NSExpression(forConstantValue: "customTile.svg") //also doesn't work
style.insertLayer(canvas, below: land)
}
}
I can successfully change the background color of this style layer but I cannot get the pattern to work. customTile
is an SVG file in the custom images folder in Mapbox Studio, and it conforms to the SVG requirements in documentation completely. When searching for the image in the style, it also does not show up which suggests to me that it's not shipping with the style. How do I get the SVG to ship with the style?