title: UITextField defaultTextAttributes bug?
body: <p>So my problem was that my app was freezing because its main thread was doing infinite loop or recursion.</p>
  
  <p>After some debugging I found out that the problem occurs only after setting <code>defaultTextAttributes</code> containing font attribute to <code>UITextField</code>. I was able to reproduce the problem in new project I created from scratch with only one <code>UIViewController</code> loaded from storyboard and containing only one <code>UITextField</code>:</p>
  
  <pre><code>class ViewController: UIViewController {
  
      @IBOutlet weak var textField: UITextField!
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          let font = UIFont.systemFont(ofSize: 17, weight: .regular)
          textField.defaultTextAttributes = [ NSAttributedString.Key.font : font ]
      }
  }
  </code></pre>
  
  <p><strong>Here is an example of stack trace of main thread when I pause execution:</strong></p>
  
  <pre><code>#0  0x00000001116050d0 in -[__NSSingleEntryDictionaryI isEqualToDictionary:] ()
  #1  0x00000001116374b7 in CFEqual ()
  #2  0x000000011802420e in TDescriptor::Equal(TDescriptor const*) const ()
  #3  0x000000011802413b in TCFBase&lt;TDescriptor&gt;::ClassEqual(void const*, void const*) ()
  #4  0x000000011cba7a94 in -[UICTFontDescriptor isEqual:] ()
  #5  0x000000011cbda45a in -[_UIFontDescriptorCacheKey _isEqualToKey:] ()
  #6  0x00000001117324ff in -[__NSDictionaryM objectForKey:] ()
  #7  0x000000011cc1213e in __25-[_UICache objectForKey:]_block_invoke ()
  #8  0x0000000112507d48 in _dispatch_client_callout ()
  #9  0x00000001125169bf in _dispatch_lane_barrier_sync_invoke_and_complete ()
  #10 0x000000011cc120af in -[_UICache objectForKey:] ()
  #11 0x000000011cbebdce in +[UIFont _fontWithDescriptor:size:textStyleForScaling:pointSizeForScaling:maximumPointSizeAfterScaling:forIB:legibilityWeight:] ()
  #12 0x000000011421570a in -[UITextField _copyFont:newSize:maxSize:] ()
  #13 0x00000001142167d9 in -[UITextField _updateAutosizeStyleIfNeeded] ()
  #14 0x00000001142199cd in -[UITextField _layoutContent] ()
  #15 0x000000011421a0e7 in -[UITextField layoutSubviews] ()
  #16 0x0000000114404d01 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
  #17 0x0000000115d18d41 in -[CALayer layoutSublayers] ()
  #18 0x0000000115d1ef33 in CA::Layer::layout_if_needed(CA::Transaction*) ()
  #19 0x0000000115d2a86a in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
  #20 0x0000000115c717c8 in CA::Context::commit_transaction(CA::Transaction*, double) ()
  #21 0x0000000115ca6ad1 in CA::Transaction::commit() ()
  #22 0x0000000113f37461 in __34-[UIApplication _firstCommitBlock]_block_invoke_2 ()
  #23 0x000000011163504c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
  #24 0x00000001116347b8 in __CFRunLoopDoBlocks ()
  #25 0x000000011162f644 in __CFRunLoopRun ()
  #26 0x000000011162ee16 in CFRunLoopRunSpecific ()
  #27 0x000000011a105bb0 in GSEventRunModal ()
  #28 0x0000000113f1fb48 in UIApplicationMain ()
  #29 0x000000010f81472b in main
  </code></pre>
  
  <p>Problem is reproduced both on simulator (iOS 13.2.2) and real device (iOS 13.1.3).
  Xcode Version 11.2.1 (11B500).
  Is it a bug in <code>UITextField</code> or am I doing something wrong?</p>
  
  <p>UPD: Looks like I has something to do with system fonts only. Changing the font to for example <code>UIFont(name: "HelveticaNeue", size: 17)</code> fixes the issue.</p>