---
title: "init(frame:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uiview/init(frame:)"
---

# init(frame:)

Creates a view with the specified frame rectangle.

## Declaration

```swift
init(frame: CGRect)
```

## Parameters

- `frame`: The frame rectangle for the view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This method uses the frame rectangle to set the doc://com.apple.uikit/documentation/UIKit/UIView/center and doc://com.apple.uikit/documentation/UIKit/UIView/bounds properties accordingly.

## Return Value

Return Value An initialized view object.

## Discussion

Discussion The new view object must be inserted into the view hierarchy of a window before it can be used. If you create a view object programmatically, this method is the designated initializer for the UIView class. Subclasses can override this method to perform any custom initialization but must call super at the beginning of their implementation. If you use Interface Builder to design your interface, this method is not called when your view objects are subsequently loaded from the nib file. Objects in a nib file are reconstituted and then initialized using their init(coder:) method, which modifies the attributes of the view to match the attributes stored in the nib file. For detailed information about how views are loaded from a nib file, see Resource Programming Guide.

## See Also

### Creating a view object

- [init(coder:)](uikit/uiview/init(coder:).md)
