title: Underline covers text in NSAttributedString
body: <p>I'm trying to create an attributed string but the underline covers my text instead of appearing behind it:</p>
  
  <p><a href="https://i.stack.imgur.com/Nnjb1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Nnjb1.png" alt="enter image description here"></a></p>
  
  <p>Is there a way to fix this? I'm using the following code:</p>
  
  <pre><code>let paragraphStyle = NSMutableParagraphStyle()
  paragraphStyle.lineSpacing = 10.0
  
  let attributes = [NSForegroundColorAttributeName: UIColor.white,
                    NSUnderlineStyleAttributeName: NSUnderlineStyle.styleThick.rawValue,
                    NSUnderlineColorAttributeName: UIColor.red,
                    NSParagraphStyleAttributeName: paragraphStyle]
  
  let attributedString = NSAttributedString(string: "Story", attributes: attributes)
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>To give more context:</p>
  
  <p>I'm displaying the attributed string on a UILabel placed in a .xib file:</p>
  
  <pre><code>view.textLabel.attributedText = attributedString
  </code></pre>
  
  <p>The label has the following font:
  <strong>System Bold 32.0</strong></p>
  
  <p>I'm running the code on iPhone 6 - iOS 10.3 simulator.</p>
  
  <p>EDIT 2:</p>
  
  <p>I should have mentioned that the label may, at some point, contain more than one line of text. That's why the numberOfLines is set to 0.</p>
  
  <p>EDIT 3:
  If anybody encounters this problem -- it seems that there is a lot of difference in how underline is drawn on iOS 9 vs 10 as well as UILabel vs UITextView. I've ended up having to draw the underline myself by subclassing NSLayoutManager.</p>