title: Make part of a UILabel bold in Swift
body: <p>I have a <code>UILabel</code> I've made programmatically as:</p>
  
  <pre><code>var label = UILabel()
  </code></pre>
  
  <p>I've then declared some styling for the label, including a font, such as:</p>
  
  <pre><code>label.frame = CGRect(x: 20, y: myHeaderView.frame.height / 2, width: 300, height: 30)
  label.font = UIFont(name: "Typo GeoSlab Regular Demo", size: 15)
  label.textColor = UIColor(hue: 0/360, saturation: 0/100, brightness: 91/100, alpha: 1)
  </code></pre>
  
  <p>The first part of the label will always read : <code>"Filter:"</code> then followed by another part of the string, for example, "Most popular" </p>
  
  <p>I would like the word filter to be in bold, so the whole thing would look like:</p>
  
  <p><strong>Filter:</strong> Most popular</p>
  
  <p>I want to simplest way of creating this effect. I've been searching the internet for how to achieve this and there are so many ways, some which just look like pages of code. And most of it seems to be in Objective-C. I would like it in Swift please :)</p>
  
  <p>I don't know if i'm on the right lines, but is this what <code>NSRange</code> can help achieve? Thanks in advance</p>
  
  <p><strong>Update</strong></p>
  
  <p>I use a series of <code>if</code> statements to change my <code>label</code> variable. Such as:</p>
  
  <pre><code>if indexArray == 1 {
  
      label.text = "Filter: Film name"
  
  } else if indexArray == 2 {
  
      label.text = "Filter: Most popular"
  
  } else if indexArray == 3 {
  
      label.text = "Filter: Star rating"
  
  }
  </code></pre>