Skip to content

FrakSharing

@MainActor final class FrakSharing

The Frak sharing sheet for a UIKit app. Build it once per screen, warm() it when a share affordance becomes visible, then present(_:) on the tap. SwiftUI apps use View.frakSharingSheet(isPresented:request:); both drive one SharingPresenter.

Hold the instance for as long as the screen lives: releasing it takes the warm web view.

Conforms to Swift.Sendable

Defined in: Sources/FrakSDKUI/FrakSharing.swift:12

init(presentingFrom:configuration:onResult:)

Section titled “init(presentingFrom:configuration:onResult:)”
@MainActor init(
presentingFrom host: UIViewController,
configuration: FrakSharingConfiguration = FrakSharingConfiguration(),
onResult: @escaping FrakSharing.ResultHandler = { _ in }
)
  • Parameters:
    • host: the view controller the sheet is presented from. Held weakly; the sheet stops working once it goes away, which is the same lifetime a screen-scoped instance wants.
    • configuration: sheet height and which store surface the install step raises.
    • onResult: called once per presentation with the most significant outcome.
@MainActor func present(_ request: SharingRequest)

Presents the sheet for request. A second call while a sheet is up is a no-op.

@MainActor func warm()

Starts warming the pooled web view and the identity/config reads. Call when a share affordance becomes visible; cheap to call repeatedly, and present(_:) implies it.

typealias ResultHandler = @MainActor @Sendable (SharingResult) -> Void

How a sharing session ended. Called once per present(_:), on the main actor.