title: UIPickerView with attributes string
body: <p>According to Apple's documentation there is a UIPickerView Delegate function called, pickerView(_:attributedTitleForRow:forComponent:). However, I've tried to make it work, but I seem to do something wrong here. I hope someone can help me out.</p>
  
  <p>To make thing easy, I have a simple program that presents the contents of two array in two components of a picker view. The program is simply one view controller and one picker view. The code is presented her:</p>
  
  <pre><code>import UIKit
  </code></pre>
  
  <p>class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {</p>
  
  <pre><code>var familyNames = [String]()
  var fontName = ""
  let firstArray = Array(0...99)
  let secondArray = Array(0...99)
  let fontCount = 0
  
  @IBOutlet weak var samplePickerView: UIPickerView!
  @IBOutlet weak var fontLabel: UILabel!
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      familyNames = UIFont.familyNames.sorted()
      let fontNames = UIFont.fontNames(forFamilyName: familyNames[17])
      fontName = fontNames.first!
  
      samplePickerView.delegate = self
      samplePickerView.dataSource = self
  }
  
  func numberOfComponents(in pickerView: UIPickerView) -&gt; Int {
      return 2
  }
  
  func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int {
  
      if component == 0 {
          return firstArray.count
      } else {
          return secondArray.count
      }
  }
  
  func pickerView(_ pickerView: UIPickerView, attributedTitleForRow row: Int, forComponent component: Int) -&gt; NSAttributedString? {
  
      var rowTitle = ""
      let font = UIFont(name: fontName, size: 18.0)
      let stringDictionary = [NSAttributedString.Key.font: font]
  
      switch component {
      case 0:
          rowTitle = String(format: "%03d", firstArray[row])
      case 1:
          rowTitle = String(format: "%03d", secondArray[row])
      default:
          break
      }
  
      let returnString = NSAttributedString(string: rowTitle, attributes: stringDictionary as [NSAttributedString.Key : Any])
      print(returnString)
      return returnString
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The picker view should now present the titles in Bradley Hand, so it's easy to spot that is worked. 
  Unfortunately, the picker view is not presenting the titles in the attributed string. The string returned by the delegate method is an attributed string, so it should work. The pictures shows this is not the case. What am I doing wrong?
  <a href="https://i.stack.imgur.com/Xvj2a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xvj2a.png" alt="enter image description here"></a></p>