Skip to content

Commit

Permalink
Clarify purpose of strict mode in removingGhostTextFromString:strict:
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gleitman committed Apr 3, 2024
1 parent bb542ba commit 5b951f7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,10 @@ - (void)setGhostText:(NSString *)ghostText {

/**
* Attempts to remove the ghost text from a provided string given our current state.
* If `strict` mode is enabled, this method asserts if we don't find the ghost text in the expected location.
* If disabled and we don't find the ghost text, we assume it's already been removed and just return the input string.
* If `strict` mode is enabled, this method assumes the ghost text exists exactly
* where we expect it to be, and we assert if this turns out to not be the case.
* If disabled, we allow for the possibility that the ghost text has already been removed,
* which can happen if a delegate callback is trying to remove ghost text after invoking `setAttributedText:`.
*/
- (NSAttributedString *)removingGhostTextFromString:(NSAttributedString *)string strict:(BOOL)strict {
if (_ghostText == nil) {
Expand Down

0 comments on commit 5b951f7

Please sign in to comment.