# SizeGuideButton (UIKit)

> The same button as a UIView.

Source: https://docs.tryyoursize.com/reference/ios/size-guide-button/

*Component* · `TryYourSize (Swift)`

The same button as a `UIView`. Auto Layout sizes it from its content. `product`, `variant`, `label` and `onRecommendation` can be changed later.

```swift
public init(client: TryYourSize, product: String, variant: SizeGuide.Variant = .link, label: String? = nil)
```

## Parameters

- **`client`** (`TryYourSize`, required): Your client.
- **`product`** (`String`, required): Your product ID or SKU.
- **`variant`** (`SizeGuide.Variant`, optional, default `.link`)
- **`label`** (`String?`, optional, default `nil`)

## Example

**Swift**

```swift
// UIKit
let guide = SizeGuideButton(client: tys, product: "SKU-123", variant: .button)
guide.onRecommendation = { rec in /* … */ }
stack.addArrangedSubview(guide)
```

**Kotlin**

```kotlin
// Views
val guide = SizeGuideView(context).apply {
    client = tys
    product = "SKU-123"
    variant = SizeGuideVariant.BUTTON
    onRecommendation = { rec -> /* … */ }
}
```
