<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIBarButtonItemGroup/init(barButtonItems:representativeItem:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIBarButtonItemGroup(im)initWithBarButtonItems:representativeItem:"
  },
  "title" : "init(barButtonItems:representativeItem:)"
}
-->

# init(barButtonItems:representativeItem:)

Creates a fixed group with the specified items.

```
init(barButtonItems: [UIBarButtonItem], representativeItem: UIBarButtonItem?)
```

## Parameters

`barButtonItems`

The bar button items to display on the bar. Typically, the items in a group are related to each other in some way, although that need not be the case. You must not specify an empty array.

`representativeItem`

A bar button item to display when there isn’t enough room to display the items in `barButtonItems`. The object you specify must be distinct from the objects in the `barButtonItems` parameter. It’s a programmer error to specify an object that’s also in the array passed to the `barButtonItems` parameter. You may specify `nil` for this parameter.

## Return Value

An initialized bar button item group.

## Discussion

When you use this initializer to create a group for a navigation bar, it produces the same result as [`fixedGroup(representativeItem:items:)`](/documentation/UIKit/UIBarButtonItemGroup/fixedGroup(representativeItem:items:)) (Swift) or [`fixedGroupWithRepresentativeItem:items:`](/documentation/UIKit/UIBarButtonItemGroup/fixedGroupWithRepresentativeItem:items:) (Objective-C).

When you use this initializer to create a group for the shortcuts bar, use the resulting group object to configure the [`leadingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/leadingBarButtonGroups) or [`trailingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/trailingBarButtonGroups) property of a [`UITextInputAssistantItem`](/documentation/UIKit/UITextInputAssistantItem) object.

---

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)