title: How to set letter spacing of UITextField
body: <p>I have an app in which the user has to type a four digit pin code. All digits have to be at a set distance from each other.</p>
  
  <p>Is there a way to do this if the <code>PinTextField</code> is a subclass of <code>UIView</code>? I know in a <code>ViewController</code> you could use <code>UITextFieldTextDidChangeNotification</code> and set the attributed text for each change. Notifications don't seem to work in a <code>UIView</code> though.</p>
  
  <p>Also I was wondering if there isn't a simpler way than making an attributed string for every update if you want to set the letter spacing of a <code>UITextField</code> text ?</p>
  
  <p>Correct spacing:</p>
  
  <p><a href="https://i.stack.imgur.com/iMirl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iMirl.png" alt="TextField with correct spacing"></a></p>
  
  <p>Wrong spacing:</p>
  
  <p><a href="https://i.stack.imgur.com/0MMqB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0MMqB.png" alt="TextField with wrong spacing"></a></p>