<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Messages",
  "identifier" : "/documentation/Messages/MSMessagesAppTranscriptPresentation/contentSizeThatFits(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Messages"
    ],
    "preciseIdentifier" : "c:objc(pl)MSMessagesAppTranscriptPresentation(im)contentSizeThatFits:"
  },
  "title" : "contentSizeThatFits(_:)"
}
-->

# contentSizeThatFits(_:)

The size of your messages view, given the provided maximum size.

```
func contentSizeThatFits(_ size: CGSize) -> CGSize
```

## Parameters

`size`

The maximum available size, in points.

## Discussion

The system calls this method only when the Messages app needs to update the view’s size and the view controller is presenting a live view in the transcript or input field (the view controller’s [`presentationStyle`](/documentation/Messages/MSMessagesAppViewController/presentationStyle) property is set to the [`MSMessagesAppPresentationStyle.transcript`](/documentation/Messages/MSMessagesAppPresentationStyle/transcript) value). Typically, the view’s size needs updating when the live message is added to the transcript, when the transcript’s width changes, or when the locale or dynamic type size changes.

The [`MSMessagesAppViewController`](/documentation/Messages/MSMessagesAppViewController) class’s default implementation of the [`contentSizeThatFits(_:)`](/documentation/Messages/MSMessagesAppTranscriptPresentation/contentSizeThatFits(_:)) method simply returns the `size` parameter. Override this method to return an appropriate size for your live message view that fits within the provided size. The returned value must be equal to or smaller than the `size` parameter.

---

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)