When I needed to determine rect wrapping my text
let rect = NSString(string: name).boundingRect(with: CGSize(width: frame.width, height: 40), options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14)], context: nil)
I ran into .usesLineFragmentOrigin string drawing option. So I did not understand what this is an option and even more why somewhere some people uses NSStringDrawingOptions.usesFontLeading.union(NSStringDrawingOptions.usesLineFragmentOrigin) instead. When I was searching for answers, I was directed to Confused by NSStringDrawingOptions item meaning discussion, so from the first answer i derived that this option appears also in NSAttributedString()s instance method draw(with:options:context:), and I got why do we need it there. But I did not got what its conception or intention in String's boundingRect function. Even more I tried to contemplate on how can i apply NSAttributedString()s instance method draw(with:options:context:). So we haw a NSAttributedString() class, it has a method draw(with:options:context:). I thought i can create attributed string, then call method draw(at: )and specify a rect. But nothing worked. Please if someone knows, how can I use NSAttributedString()s draw(with:options:context:) function? And what this is an option .usesLineFragmentOrigin form the point of boundRect's function and why somewhere some people uses NSStringDrawingOptions.usesFontLeading.union(NSStringDrawingOptions.usesLineFragmentOrigin) instead? Thank you!