title: How can I vertically align an image to the center of the first line of some text?
body: <p>I have a bullet point and some long, multiline text. I want the bullet point to be aligned with the center of the first line of text. Obviously, If the string is sufficiently short and one line long then the two views are automatically center aligned. I'm interested in cases where text is more than one line long.</p>
  <pre><code>var body: some View {
      HStack {
          Image(systemName: &quot;circle.fill&quot;)
              .font(.system(size: 8))
          Text(&quot;Insert really long multiline string that wraps.&quot;)
      }
  }
  </code></pre>
  <p>Is this possible?</p>
  <h3>Update 1:</h3>
  <p>Setting the HStack alignment to top aligns the top of the image with the top of the text, like this...</p>
  <pre><code>var body: some View {
      HStack(alignment: .top) {
          Image(systemName: &quot;circle.fill&quot;)
              .font(.system(size: 8))
          Text(&quot;This is really really really really really really really really really really really really really really really really really really really really really really really really long string.&quot;)
      }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/wcYWM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wcYWM.png" alt="image 1" /></a></p>
  <h3>Update 2:</h3>
  <p>The only option I can think of is something like <a href="https://stackoverflow.com/a/58632272/6191825">this</a>, except this is UIKit...</p>
  <pre><code>// Aligns the icon to the center of a capital letter in the first line
  let offset = label.font.capHeight / 2.0
  
  // Aligns the icon to the center of the whole line, which is different
  // than above. Especially with big fonts this makes a visible difference.
  let offset = (label.font.ascender + label.font.descender) / 2.0
  
  let constraints: [NSLayoutConstraint] = [
    imageView.centerYAnchor.constraint(equalTo: label.firstBaselineAnchor, constant: -offset),
    imageView.trailingAnchor.constraint(equalTo: label.leadingAnchor, constant: -10)
  ]
  NSLayoutConstraint.activate(constraints)
  </code></pre>