title: Proper way to concatenate optional swift strings?
body: <pre><code>struct Person {
     var firstName: String?
     var lastName: String?
  }
  </code></pre>
  <p>Now I want to construct a <code>fullName</code> string that contains either just their first or last name (if that's all that is available), or if we have both, their first and last name with a space in the middle.</p>
  <pre><code>var fullName: String?
  if let first = person.firstName {
      fullName = first
  }
  if let last = person.lastName {
      if fullName == nil {
          fullName = last
      } else {
          fullName += &quot; &quot; + last
      }
  }
  </code></pre>
  <p>or</p>
  <pre><code>var fullName = &quot;&quot;
  if let first = person.firstName {
      fullName = first
  }
  if let last = person.lastName {
      fullName += fullName.count &gt; 0 ? (&quot; &quot; + last) : last
  }
  </code></pre>
  <p>Are we just supposed to nest <code>if let</code>'s? Nil coalescing seems appropriate but I can't think of how to apply it in this scenario. I can't help but feeling like I'm doing optional string concatenation in an overly complicated way.</p>