Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15671

Using a ShareLink with a custom exported type identifier does not display any sharing options

$
0
0

I'm working with a custom exported type in my macOS app when I found that SwiftUI's ShareLink would not display any options for sharing.
Currently, I have a type that conforms to public.data and public.json, with a unique identifier and file extension too.

Here's a screenshot of the empty share sheet:

screenshot of share sheet:

After searching through the documentation on Uniform Type Identifiers, I found this written about the content type:

For document types, conform to public.content, either directly or by conforming to a type that already conforms to public.content. This conformance allows users to share your type over AirDrop.

This seems to be not true in my context, so I assume that I have made a mistake.

Here's my current Transferable conformance:

extension Quote: Transferable {    static var transferRepresentation: some TransferRepresentation {        CodableRepresentation(contentType: .quote)    }}extension UTType {    // Real type identifier is not com.example, of course    static var quote: UTType { UTType(exportedAs: "com.example.quote") }}

These are the declarations of exported type identifiers and document types in my Xcode project settings:

Declarations of exported type identifiers and document types.

This is what the ShareLink looks like:

ShareLink(    item: Quote(text: "In a galaxy far far away..."),    preview: SharePreview("An intersting quote"),    label: { Image(systemName: "square.and.arrow.up") })

Does anyone know why this issue of having no Share Options is occurring with this custom exported type identifier?


Viewing all articles
Browse latest Browse all 15671

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>