这就是我定义多边形特征的方式:
let polygon = MGLPolygonFeature(coordinates: &coordinates, count: UInt(coordinates.count))
polygon.attributes = ["name": card.name, "identifier": card.identifier, "color": card.set.colorMode] //UIColor
let cardSource = MGLShapeSource(identifier: "cards", features: [polygon], options: [:])
let polygonLayer = MGLFillStyleLayer(identifier: "polygon-level", source: cardSource)
polygonLayer.fillColor = MGLStyleValue(rawValue: "{color}")
polygonLayer.fillOpacity = MGLStyleValue(rawValue: 0.4)
但这不起作用。如何设置填充颜色取决于属性?