title: changing font and its size of a picker in swift
body: <p>With Objective-C, I used the code shown below to set/change font family and size of a picker:</p>
  
  <pre><code>- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {
  UILabel* tView = (UILabel*)view;
  if (!tView){
      tView = [[UILabel alloc] init];
      // Setup label properties - frame, font, colors etc
      tView.font = [UIFont fontWithName:@"Times New Roman" size:fontsize];;
  }
  tView.text = [_mysitedata findKeyForRow:row];
  NSLog(@"C key:%@ row:%ld comp:%ld", tView.text, (long int)row, (long int)component);
  return tView;
  }
  </code></pre>
  
  <p>However, Swift does not accept a cast from UIView to UILabel and hence I can not follow this path which would look something like shown below:</p>
  
  <pre><code>func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -&gt; UIView {
      let label = view as! UILabel
      label.font = UIFont(name: "Times New Roman", size: 1.0)
      label.text = pickerData[row]
      return label
  }
  </code></pre>
  
  <p>The first stament (let label ....) throuws an exception at run time:</p>
  
  <blockquote>
    <p>EXC-BAD INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)</p>
  </blockquote>