Skip to content

Instantly share code, notes, and snippets.

@frosty
Created May 4, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/66e28ecfc6d1d664bc79774c9bb22dec to your computer and use it in GitHub Desktop.
Save frosty/66e28ecfc6d1d664bc79774c9bb22dec to your computer and use it in GitHub Desktop.
diff --git a/Example/Example/EditorDemoController.swift b/Example/Example/EditorDemoController.swift
index e0029787..6f9b2ca9 100644
--- a/Example/Example/EditorDemoController.swift
+++ b/Example/Example/EditorDemoController.swift
@@ -464,6 +464,17 @@ extension EditorDemoController : UITextViewDelegate {
}
}
+ func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
+ // If the user types a tab character in the title text view,
+ // let's move focus to the editor text view.
+ guard textView == titleTextView, text == "\t" else {
+ return true
+ }
+
+ richTextView.becomeFirstResponder()
+ return false
+ }
+
func textViewShouldBeginEditing(_ textView: UITextView) -> Bool {
switch textView {
case titleTextView:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment