Skip to content

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

Open
@hermiteer

Description

@hermiteer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions