Sharing

Present the system share sheet for text, links, and images.

Inject ISharer and pass it a ShareContent value:

public sealed class ArticleViewModel(ISharer sharer)
{
    public Task ShareAsync() => sharer.ShareAsync(new ShareContent
    {
        Text = Article.Title,
        Url = new Uri(Article.Url),
        Image = Article.Thumbnail
    });
}

Text, Uri, and ImageSource values convert implicitly for the common one-item cases:

await sharer.ShareAsync("Copied from SkeleKit Gallery");
await sharer.ShareAsync(new Uri("https://example.com/article"));
await sharer.ShareAsync(ImageSource.Bundle("share-card"));

The task completes after the sheet is dismissed, whether the person shared or canceled. It does not report which destination was selected.

Share the smallest useful payload. Combining a short title, canonical link, and optional preview image generally produces better results than placing a large article body in Text.

ISharer is registered with the other built-in services described in application setup and DI, but can also be accessed from any custom view through its protected Sharer property.