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

# init(frame:textContainer:)

Creates a new text view with the specified text container.

```
init(frame: CGRect, textContainer: NSTextContainer?)
```

## Parameters

`frame`

The frame rectangle of the text view.

`textContainer`

The text container to use for the receiver (can be `nil`).

## Return Value

An initialized text view.

## Discussion

This is the designated initializer for `UITextView` objects.

---

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)