---
title: "init(type:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uibutton/init(type:)"
---

# init(type:)

Creates and returns a new button of the specified type.

## Declaration

```swift
convenience init(type buttonType: UIButton.ButtonType)
```

## Parameters

- `buttonType`: The button type. See doc://com.apple.uikit/documentation/UIKit/UIButton/ButtonType-swift.enum for the possible values.

## Return Value

Return Value A newly created button.

## Discussion

Discussion This method is a convenience constructor for creating button objects with specific configurations. When creating a custom button — a button with the type UIButton.ButtonType.custom — the frame of the button is set to (0, 0, 0, 0) initially. Before adding the button to your interface, you should update the frame to a more appropriate value.

## See Also

### Related Documentation

- [UIKit Catalog: Creating and customizing views and controls](uikit/uikit-catalog-creating-and-customizing-views-and-controls.md)

### Creating buttons of a specific type

- [init(type:primaryAction:)](uikit/uibutton/init(type:primaryaction:).md)
- [UIButton.ButtonType](uikit/uibutton/buttontype-swift.enum.md)
