mapbox / mapbox-annotation-extension

Framework extensions that can be used with the Mapbox Maps SDK for iOS.
ISC License
11 stars 18 forks source link

Improve experience when working with symbol icons #40

Closed captainbarbosa closed 4 years ago

captainbarbosa commented 4 years ago

Right now, to add an icon image to a MGLSymbolStyleAnnotation one needs to load the image from the relevant location and then use the setImage API to add it to the map style.

Since this library is all about making things easier for developers, I think it would be a good idea to do this on behalf of the developer. Perhaps MGLSymbolStyleAnnotation.iconImageName can do this behind the scenes? Here's an idea:

let symbol = MGLSymbolStyleAnnotation(coordinate: coordinate)
let customImage = UIImage(named: "custom")!

symbol.iconImageName("my-custom-image", for image: customImage)

symbol.iconImageName(customImage) 
// maybe the true icon image name can be a string version 
// of the image name if one isn't specified?
fabian-guerra commented 4 years ago

This is a duplicate of #15 will close this in favor of the former.