---
title: "messageComposeViewController(_:didFinishWith:)"
framework: messageui
role: symbol
role_heading: Instance Method
path: "messageui/mfmessagecomposeviewcontrollerdelegate/messagecomposeviewcontroller(_:didfinishwith:)"
---

# messageComposeViewController(_:didFinishWith:)

Tells the delegate that the user finished composing the message.

## Declaration

```swift
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult)
```

## Parameters

- `controller`: The message composition view controller that is returning the result.
- `result`: A result code that indicates how the user chose to complete the composition. See the doc://com.apple.messageui/documentation/MessageUI/MessageComposeResult enumeration.

## Discussion

Discussion This method is called when the user taps one of the buttons to dismiss the message composition interface. Your implementation of this method should dismiss the view controller and perform any additional actions needed to process the sending of the message. The result parameter lets you know whether the user chose to cancel or send the message, or whether sending the message failed. Implementation of this method is required.

## See Also

### Responding to the Message Completion

- [MessageComposeResult](messageui/messagecomposeresult.md)
