title: Custom Keyboard: get selected text
body: <p>From my <code>Custom Keyboard</code> I would like to know if the user has selected something in their text (and the range of it). Following the documentation I thought I can utilize the callbacks provided by the <code>UITextInputDelegate</code> protocol:</p>
  
  <ul>
  <li><strong>selectionWillChange(textInput: UITextInput)</strong></li>
  <li><strong>selectionDidChange(textInput: UITextInput)</strong></li>
  <li>textWillChange(textInput: UITextInput)</li>
  <li>textDidChange(textInput: UITextInput)</li>
  </ul>
  
  <p>However, the <code>selectionWill/DidChange</code> callbacks are never called. If I change the selection in my text, the other callbacks are triggered (<code>textWill/DidChange</code>) instead. As this is already odd, the problem I have is that the <code>textInput</code> param is always nil. But I need it, as I would like to access <code>selectedTextRange</code> to solve my problem.</p>
  
  <p>Any ideas <strong>how to retrieve the currently selected text</strong> and/or its range within a custom keyboard implementation?</p>