Skip to content

Can we make APNSClient's Sendable conformance public? #222

@mergesort

Description

@mergesort

Is your feature request related to a problem? Please describe.
I'm attempting to integrate APNSwift into my Vapor project, and my app follows a pattern where I store dependencies in a StorageKey. Due to this conformance, the type being added to the StorageKey must be marked Sendable.

public protocol StorageKey { /// The type of the stored value associated with this key type. associatedtype Value: Sendable }

Describe the solution you'd like
I noticed this extension already exists, and both JSONEncoder and JSONDecoder are marked as @unchecked Sendable in Apple's frameworks, so assuming this is possible to do in APNSwift it should be a quick improvement.

extension APNSClient: Sendable where Decoder: Sendable, Encoder: Sendable {}

Describe alternatives you've considered
I started by making my own @unchecked Sendable wrapper before noticing that conformance already existed. I don't really find much value from it and it's kind of an ugly solution, but I could always fall back to it if needed.

final class SendableAPNSClient: @unchecked Sendable { let client: APNSClient<JSONDecoder, JSONEncoder> private init(client: APNSClient<JSONDecoder, JSONEncoder>) { self.client = client } }

Additional context
Not much really, except to say that so far using the project has been a delight so thank you very much for that!

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