I'm building an app with a messenger like interface.   
 I use a tableView to accomplish this. Each cell contains a UIView - the message bubble and a `UILabel` - the message that is nested in the `UIView`.   

It works great on texts of small sizes but for some reason when the `UILabel` is supposed to break lines it doesn't and it all is in one line. The amount of lines is set to zero.

This is my message handling class:

```
    func commonInit() {

    print(MessageView.frame.height)
    MessageView.clipsToBounds = true
    MessageView.layer.cornerRadius = 15
    myCellLabel.numberOfLines = 0
    let bubbleSize = CGSize(width: self.myCellLabel.frame.width + 28, height: self.myCellLabel.frame.height + 20)
    print(bubbleSize.height)
    MessageView.frame = CGRect(x: self.frame.origin.x, y: self.frame.origin.y, width: bubbleSize.width, height: bubbleSize.height)

    if reuseIdentifier! == "Request" {
        MessageView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMinXMaxYCorner]
        MessageView.backgroundColor = UIColor(red: 0, green: 122/255, blue: 1.0, alpha: 1.0)
    } else  {
        MessageView.layer.maskedCorners = [.layerMaxXMinYCorner, .layerMinXMinYCorner, .layerMaxXMaxYCorner]
        MessageView.backgroundColor = UIColor.lightGray
    }

}

```

Cell calling function: 

```
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    if queryCounter % 2 == 0 && indexPath.row % 2 == 0{
        cellReuseIdentifier = "Answer"

    } else {
        cellReuseIdentifier = "Request"
    }

    let cell:MessageCell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as! MessageCell
    cell.myCellLabel.textColor = UIColor.white
    cell.myCellLabel.text = self.messages[indexPath.row]
    let height = cell.myCellLabel.text!.height(withConstrainedWidth: cell.myCellLabel.frame.width, font: cell.myCellLabel.font)
    print(height)
    cell.contentView.transform = CGAffineTransform(scaleX: 1, y: -1)

    return cell
}

```

The height variable is calculated based on text size. It shows that the text size is calculated normally - accounting for line break. 
I was unable to modify the cell height based on this calculation - nothing I tried works. 
I think it might be a constraints issue.   

My Constraints: [![enter image description here](https://i.stack.imgur.com/0abst.png)](https://i.stack.imgur.com/0abst.png)

[![enter image description here](https://i.stack.imgur.com/UkVIX.png)](https://i.stack.imgur.com/UkVIX.png)

How do I make the lines break? Please help.

EDIT: I just notice that the `MessageView.frame = CGRect(x: self.frame.origin.x, y: self.frame.origin.y, width: bubbleSize.width, height: bubbleSize.height)` has no affect what so ever on the message bubbles.