This solution will help to calculate the height and width at runtime.
let messageText = "Your Text String"
let size = CGSize.init(width: 250, height: 1000)
let options = NSStringDrawingOptions.usesFontLeading.union(.usesLineFragmentOrigin)
let estimateFrame = NSString(string: messageText).boundingRect(with: size, options: options, attributes: [NSAttributedString.Key.font: UIFont(name: "HelveticaNeue", size: 17)!], context: nil)
Here you can calculate the estimated height that your string would take and pass it to the UILabel frame.
estimateFrame.Width
estimateFrame.Height