mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

PointAnnotation.image fails silently if name is nil or empty

Open Rheaparks opened this issue 3 years ago • 0 comments

Environment

  • Xcode version: 13.2.1
  • iOS version: 15.2
  • Devices affected: All
  • Maps SDK Version: 10.3.0

Observed behavior and steps to reproduce

Setting a point annotation image via the convenience image property fails silently if the provided name is nil or empty.

Expected behavior

This should be either documented or at least logged. In the current state, the pin is successfully added to the map, however, its image is empty which makes the pin invisible. Maybe this convenience property should be removed since it can easily be misinterpreted.

Discussion

Why does PointAnnotation.Image needs both an image and a name? What is even this name?

extension PointAnnotation {
    public struct Image: Hashable {
        public var image: UIImage
        public var name: String

        public init(image: UIImage, name: String) {
            self.image = image
            self.name = name
        }
     }
}

I think it could be simpler to allow us to simply send an UIImage or even an UIImage "name".

Rheaparks avatar Mar 01 '22 09:03 Rheaparks