Kingfisher icon indicating copy to clipboard operation
Kingfisher copied to clipboard

Collision with name 'ImageResource'

Open vegadodo opened this issue 10 months ago • 1 comments

When Kingfisher is imported, for ImageResource, Xcode will complain that

'ImageResource' is ambiguous for type lookup in this context
    Found this candidate (DeveloperToolsSupport.ImageResource)
@available(*, deprecated, message: "This type conflicts with `GeneratedAssetSymbols.ImageResource` in Swift 5.9. Renamed to avoid issues in the future.", renamed: "KF.ImageResource")
public typealias ImageResource = KF.ImageResource


extension KF {
    /// ``ImageResource`` is a simple combination of ``downloadURL`` and ``cacheKey``.
    /// When passed to image view set methods, Kingfisher will try to download the target
    /// image from the ``downloadURL``, and then store it with the ``cacheKey`` as the key in cache.
    public struct ImageResource: Resource {
        ...
    }
}

Although it seems like KF.ImageResource was renamed to avoid this issue, apparently Xcode can't tell the two apart. Current workaround is to use the full path DeveloperToolsSupport.ImageResource

Reported on:

  • Kingfisher 8.3.2
  • Xcode 16.4 (16F6) (Swift 6.1.2 (6.1.2.1.2))
  • macOS 15.5

vegadodo avatar Jun 08 '25 15:06 vegadodo

TODO: Find a good time to completely remove the old name.

onevcat avatar Jun 23 '25 12:06 onevcat