<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSToolbarItemGroup/setSelected(_:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSToolbarItemGroup(im)setSelected:atIndex:"
  },
  "title" : "setSelected(_:at:)"
}
-->

# setSelected(_:at:)

Sets the selected state of a subitem in a grouped toolbar item.

```
func setSelected(_ selected: Bool, at index: Int)
```

## Parameters

`selected`

If `true`, indicates whether to select a subitem, `false` otherwise.

`index`

The index location of the subitem.

---

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)