@@ -59,7 +59,7 @@ @interface SLKTextViewController ()
59
59
@property (nonatomic ) BOOL newWordInserted;
60
60
61
61
// YES if the view controller did appear and everything is finished configurating. This allows blocking some layout animations among other things.
62
- @property (nonatomic ) BOOL isViewVisible ;
62
+ @property (nonatomic , getter =isViewVisible ) BOOL viewVisible ;
63
63
64
64
// The setter of isExternalKeyboardDetected, for private use.
65
65
@property (nonatomic , getter = isRotating) BOOL rotating;
@@ -201,7 +201,7 @@ - (void)viewDidAppear:(BOOL)animated
201
201
202
202
[self .scrollViewProxy flashScrollIndicators ];
203
203
204
- self.isViewVisible = YES ;
204
+ self.viewVisible = YES ;
205
205
}
206
206
207
207
- (void )viewWillDisappear : (BOOL )animated
@@ -211,7 +211,7 @@ - (void)viewWillDisappear:(BOOL)animated
211
211
// Stops the keyboard from being dismissed during the navigation controller's "swipe-to-pop"
212
212
self.textView .didNotResignFirstResponder = self.isMovingFromParentViewController ;
213
213
214
- self.isViewVisible = NO ;
214
+ self.viewVisible = NO ;
215
215
216
216
// Caches the text before it's too late!
217
217
[self slk_cacheTextView ];
@@ -1297,8 +1297,10 @@ - (void)slk_didChangeTextViewText:(NSNotification *)notification
1297
1297
// Animated only if the view already appeared.
1298
1298
[self textDidUpdate: self .isViewVisible];
1299
1299
1300
- // Process the text at text change
1301
- [self slk_processTextForAutoCompletion ];
1300
+ // Process the text at every change, when the view is visible
1301
+ if (self.isViewVisible ) {
1302
+ [self slk_processTextForAutoCompletion ];
1303
+ }
1302
1304
}
1303
1305
1304
1306
- (void )slk_didChangeTextViewContentSize : (NSNotification *)notification
@@ -1720,7 +1722,7 @@ - (void)textViewDidChange:(UITextView *)textView
1720
1722
// Keep to avoid unnecessary crashes. Was meant to be overriden in subclass while calling super.
1721
1723
}
1722
1724
1723
- - (void )textViewDidChangeSelection : (SLKTextView *)textView
1725
+ - (void )textViewDidChangeSelection : (UITextView *)textView
1724
1726
{
1725
1727
// Keep to avoid unnecessary crashes. Was meant to be overriden in subclass while calling super.
1726
1728
}
0 commit comments