Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add an associated AttachmentMetadata type to Attachable. #824

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Nov 14, 2024

This PR adds a new associated type to Attachable that can be used to supply additional metadata to an attachment that is specific to that type. Metadata is always optional and the default type is Never (i.e. by default there is no metadata.)

The Encodable and NSSecureCoding conformances in the Foundation cross-import overlay have been updated such that this type equals a new structure that describes the format to use as well as options to pass to the JSON encoder (if one is used) and user info to pass to the plist or JSON encoders (if used.) We must use this type even for types that conform only to NSSecureCoding, otherwise we get compile-time errors about the type being ambiguous if a type conforms to both protocols and to Attachable.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR adds a new associated type to `Attachable` that can be used to supply
additional metadata to an attachment that is specific to that type. Metadata is
always optional and the default type is `Never` (i.e. by default there is no
metadata.)

The `Encodable` and `NSSecureCoding` conformances in the Foundation cross-import
overlay have been updated such that this type equals a new structure that
describes the format to use as well as options to pass to the JSON encoder (if
one is used) and user info to pass to the plist or JSON encoders (if used.) We
must use this type even for types that conform only to `NSSecureCoding`,
otherwise we get compile-time errors about the type being ambiguous if a type
conforms to both protocols and to `Attachable`.
@grynspan grynspan added enhancement New feature or request public-api Affects public API attachments/activities 🖇️ Work related to attachments and/or activities labels Nov 14, 2024
@grynspan grynspan self-assigned this Nov 14, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attachments/activities 🖇️ Work related to attachments and/or activities enhancement New feature or request public-api Affects public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant