<!--
{
  "documentType" : "article",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/displaying-a-checkbox-in-your-mac-app-built-with-mac-catalyst",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Displaying a checkbox in your Mac app built with Mac Catalyst"
}
-->

# Displaying a checkbox in your Mac app built with Mac Catalyst

Present a switch control as a Mac-style checkbox when your app runs in the Mac user interface idiom.

## Discussion

A Mac app built with Mac Catalyst that uses the Mac user interface idiom displays a [`UISwitch`](/documentation/UIKit/UISwitch) as a checkbox when the [`preferredStyle`](/documentation/UIKit/UISwitch/preferredStyle) value is [`UISwitch.Style.automatic`](/documentation/UIKit/UISwitch/Style-swift.enum/automatic) (the default value) or [`UISwitch.Style.checkbox`](/documentation/UIKit/UISwitch/Style-swift.enum/checkbox). If your app doesn’t use the [`UIUserInterfaceIdiom.mac`](/documentation/UIKit/UIUserInterfaceIdiom/mac) idiom, the switch appears as a slider switch. To learn more, see [Choosing a user interface idiom for your Mac app](/documentation/UIKit/choosing-a-user-interface-idiom-for-your-mac-app).

### Add text to the checkbox

To display text alongside the checkbox, set the [`title`](/documentation/UIKit/UISwitch/title) property.

```swift
let showFavoritesAtTop = UISwitch()
showFavoritesAtTop.title = "Always show favorite recipes at the top"
```

### Resize the checkbox

A checkbox-style switch has a default frame size of zero. If you’re not using Auto Layout to determine the size and position of the switch, call [`sizeToFit()`](/documentation/UIKit/UIView/sizeToFit()) to resize it so that it uses the appropriate amount of space needed to display the checkbox and its title.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)