mapbox/turf-swift

JSONArray: RawRepresentable conflicts with Array: RawRepresentable where Element: Codable

hermiteer opened this issue · 1 comments

There's a popular pattern of folks extending arrays of Codable to allow use with @AppStorage as described here:

https://stackoverflow.com/questions/62562534/swiftui-what-is-appstorage-property-wrapper/62563773#62563773

Unfortunately Turf's JSONArray conflicts with this extension due to:

Conflicting conformance of 'Array<Element>' to protocol 'RawRepresentable'; there cannot be more than one conformance, even with different conditional bounds

If Swift won't allow multiple RawRepresentable extensions, what are our options here? Is it possible to keep JSONArray internal to the Turf package? For that matter, do any of the JSON types need to be public?

So far I've been unable to find another way to express the Array extension that makes the compiler happy, so would love to hear any other ideas.

Note: I'm not using Turf directly, it comes with the Mapbox SDK.