I am trying to calculate the height of a UILabel based on different String lengths.
func calculateContentHeight() -> CGFloat{ var maxLabelSize: CGSize
In Swift 5:
label.textRect(forBounds: label.bounds, limitedToNumberOfLines: 1)
btw, the value of limitedToNumberOfLines depends on your label's text lines you want.
limitedToNumberOfLines