Skip to content

Commit e60d66b

Browse files
committed
fix(link): avoid hard link to TolerantDecoder using NSClassFromString; still use if present
1 parent ba7d931 commit e60d66b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

AvroKeyboardController.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#import <RegexKitLite/RegexKitLite.h>
1414
#import "AvroParser.h"
1515
#import "AutoCorrect.h"
16-
#import "TolerantDecoder.h"
1716
#import "RomanNormalizer.h"
1817

1918
@implementation AvroKeyboardController
@@ -63,7 +62,14 @@ - (void)findCurrentCandidates {
6362
CFAbsoluteTime t0 = CFAbsoluteTimeGetCurrent();
6463
NSString *norm = [RomanNormalizer normalize:termForLookup];
6564
// Choose best tolerant correction (includes original)
66-
NSString *best = [TolerantDecoder bestFor:norm];
65+
Class decClass = NSClassFromString(@"TolerantDecoder");
66+
NSString *best = norm;
67+
if (decClass && [decClass respondsToSelector:@selector(bestFor:)]) {
68+
#pragma clang diagnostic push
69+
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
70+
best = [decClass performSelector:@selector(bestFor:) withObject:norm];
71+
#pragma clang diagnostic pop
72+
}
6773
// Optionally, merge original+best lookups for broader suggestions
6874
if ([best isEqualToString:norm]) {
6975
termForLookup = best;

0 commit comments

Comments
 (0)