title: iOS Custom Keyboard Extension auto capitalization
body: <p>I have designed a custom keyboard extension and I am able to enter text properly. However I can't seem to be able to figure out when to enable a capitalized keyboard and when lowercase. This is mostly because the following functions don't correctly return the already entered before/after text. Sometimes they will return nil, sometimes only a last few characters etc. Many times these methods are not even called at all.</p>
  
  <pre><code>- (void)textWillChange:(id&lt;UITextInput&gt;)textInput 
  
  - (void)textDidChange:(id&lt;UITextInput&gt;)textInput
  </code></pre>
  
  <p>I have figured out the following scenarios when I need to have enable my uppercase keyboard:</p>
  
  <ol>
  <li>Text length =0 or nil</li>
  <li>When a period is entered, I need to add a space and uppercase keyboard</li>
  <li>When the cursor is placed at a location where the character before cursor is either a period or a space and before that is a period.</li>
  <li>When user selected the entire text "Select All"</li>
  <li>When user selected the entire text and deleted all</li>
  <li>When user backspaces and the new character before cursor is either a period or a space and before that is a period.</li>
  <li>When user pastes text and the character before cursor is either a period or a space and before that is a period.</li>
  </ol>
  
  <p>Also if the above is possible, is it possible to also get the last entered "entire" word which I can use for dictionary searches like for predictive typing?</p>
  
  <p>I have read the apple document where it states that users expect auto-capitalization, so I am sure this should be possible</p>
  
  <p><a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html">https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html</a></p>