This example shows how a label’s width can automatically resize when the text content changes.

http://i.stack.imgur.com/hOUX0.gif

Pin the left and top edges

Just use auto layout to add constraints to pin the left and top sides of the label.

http://i.stack.imgur.com/5PTKG.png

After that it will automatically resize.

Notes

import UIKit
class ViewController: UIViewController {

    @IBOutlet weak var myLabel: UILabel!

    @IBAction func changeTextButtonTapped(sender: UIButton) {
        myLabel.text = "my name is really long i want it to fit in this box"
    }
}

http://i.stack.imgur.com/V2Ok9.gif

http://i.stack.imgur.com/4mYVz.png