share

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package share opens the system share sheet with text, a URL and/or files: UIActivityViewController on iOS, an ACTION_SEND chooser on Android, NSSharingServicePicker on macOS.

err := share.Share(a, share.Options{Text: "Look at this", URL: "https://example.com"})
if errors.Is(err, share.ErrCanceled) { ... }

Share blocks until the sheet is dismissed (iOS, macOS) or shown (Android, which does not report what the user did). It returns ErrUnsupported where the backend has no share sheet and tango.ErrNotRunning after the app quit. On Android call it from a goroutine, not from a main-thread callback (see docs/mobile.md).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupported = platform.ErrUnsupported
	ErrCanceled    = platform.ErrCanceled
)

Functions

func Share

func Share(a *tango.App, o Options) error

Share shows the share sheet and waits for the user.

Types

type Options

type Options struct {
	Text  string
	URL   string
	Files []string // paths of existing files
	Title string   // chooser title (Android) / subject for mail
}

Options is what to share. At least one of Text, URL and Files is needed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL