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

# init(frame:collectionViewLayout:)

Creates a collection view object with the specified frame and layout.

```
init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout)
```

## Parameters

`frame`

The frame rectangle for the collection view, measured in points. The origin of the frame is relative to the superview in which you plan to add it. This frame is passed to the superclass during initialization.

`layout`

The layout object to use for organizing items. The collection view stores a strong reference to the specified object. Must not be `nil`.

## Return Value

An initialized collection view object, or `nil` if the object couldn’t be created.

## Discussion

Use this method when initializing a collection view object programmatically.

This method is the designated initializer.

---

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)