# FrakSharing

```swift
@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](https://github.com/frak-id/wallet/blob/35995d05c807efe1e0d6319fdede3ad363124d1e/sdk/ios/Sources/FrakSDKUI/FrakSharing.swift#L12)

## Initializers

### init(presentingFrom:configuration:onResult:)

```swift
@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.

## Methods

### present(_:)

```swift
@MainActor func present(_ request: SharingRequest)
```

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

### warm()

```swift
@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.

## Other members

### FrakSharing.ResultHandler

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

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