ShareContext

struct ShareContext : Encodable

Leaf data for the shareButton/shareModal partials, made from any Shareable. Add a share: ShareContext? to a page’s context, then #extend("shareButton") and #extend("shareModal") in its template.

  • url

    Declaration

    Swift

    private(set) var url: String { get }
  • Server-relative URL of a QR code image encoding url. See qrCodeImageURL(encoding:).

    Declaration

    Swift

    private(set) var qrCodeURL: String { get }
  • Declaration

    Swift

    init?(_ item: some Shareable)
  • Builds the URL of an image of a QR code that encodes string, for use in an <img> tag. The URL is relative so the image loads from whatever host served the page, even if that isn’t the canonical host (dev instances, tunnels, LAN addresses). string is what the QR code contains, and should be built from the canonical server URL.

    Declaration

    Swift

    static func qrCodeImageURL(encoding string: String) -> String?