I am creating an app in Swift. I am having an UILabel with dynamic data. I want to apply restriction of two lines to that UILabel i.e. it should do word wrapping and show text in just 2 lines only. Any solution will be appreciated. Thank you in advance.
titleLabel.numberOfLines = 0; [titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
titleLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping titleLabel.numberOfLines = 2 // titleLabel.numberOfLines = 0 //'0' means infinite number of lines