Skip to content

Commit 022095c

Browse files
committed
refactor(objc-to-swift): migrate EZAppleDictionary to Swift
Migrate the Apple Dictionary service from Objective-C to Swift, following the same pattern established by other Swift service migrations. - Create AppleDictionary.swift with @objc(EZAppleDictionary) annotation for Objective-C compatibility - Move apple-dictionary.html to Swift service folder - Add DictionaryKit.h and NSString+EZHandleInputText.h to bridging header - Remove EZAppleDictionary.h/.m imports from dependent Objective-C files - Update Xcode project configuration
1 parent af98d9c commit 022095c

File tree

11 files changed

+493
-779
lines changed

11 files changed

+493
-779
lines changed

Easydict.xcodeproj/project.pbxproj

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
030D61252CD9B906000DF298 /* AcknowListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 030D61242CD9B905000DF298 /* AcknowListView.swift */; };
2121
030D612C2CD9BB34000DF298 /* Pods-Easydict-acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = 030D612B2CD9BB34000DF298 /* Pods-Easydict-acknowledgements.plist */; };
2222
030D612E2CD9BBC3000DF298 /* Package.resolved in Resources */ = {isa = PBXBuildFile; fileRef = 030D612D2CD9BBC3000DF298 /* Package.resolved */; };
23-
0310C8272A94F5DF00B1D81E /* apple-dictionary.html in Resources */ = {isa = PBXBuildFile; fileRef = 0310C8262A94EFA100B1D81E /* apple-dictionary.html */; };
2423
0311A5AC2E150522007AB02B /* OCRTextNormalizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0311A5AB2E150522007AB02B /* OCRTextNormalizer.swift */; };
2524
0312584F2E1802650072320C /* AppleLanguageDetectorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0312584E2E1802650072320C /* AppleLanguageDetectorTests.swift */; };
2625
031258512E18C4EA0072320C /* String+ToChinese.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031258502E18C4EA0072320C /* String+ToChinese.swift */; };
@@ -37,6 +36,8 @@
3736
031C66D02ED9EB290025D190 /* BingLookupResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031C66C62ED9EB290025D190 /* BingLookupResponse.swift */; };
3837
031C66D12ED9EB290025D190 /* BingLanguageVoice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031C66C52ED9EB290025D190 /* BingLanguageVoice.swift */; };
3938
031C66D22ED9EB290025D190 /* BingConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031C66C42ED9EB290025D190 /* BingConfig.swift */; };
39+
031C66D42ED9F9E30025D190 /* AppleDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031C66D32ED9F9E30025D190 /* AppleDictionary.swift */; };
40+
031C66D62ED9F9E40025D190 /* apple-dictionary.html in Resources */ = {isa = PBXBuildFile; fileRef = 031C66D52ED9F9E40025D190 /* apple-dictionary.html */; };
4041
031CBA642CD76F1500364437 /* ChatMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031CBA632CD76F1500364437 /* ChatMessage.swift */; };
4142
031DBD792AE01E130071CF85 /* easydict in Resources */ = {isa = PBXBuildFile; fileRef = 031DBD782AE01E130071CF85 /* easydict */; };
4243
0320411A2E43BEB50065A05B /* ocr-en-text-4.png in Resources */ = {isa = PBXBuildFile; fileRef = 032041192E43BEB50065A05B /* ocr-en-text-4.png */; };
@@ -94,7 +95,6 @@
9495
033A8EAE2BDFE09B00030C08 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033A8EAD2BDFE09B00030C08 /* String+Extension.swift */; };
9596
033B7134293CE2430096E2DF /* EZWebViewTranslator.m in Sources */ = {isa = PBXBuildFile; fileRef = 033B7133293CE2430096E2DF /* EZWebViewTranslator.m */; };
9697
033C30FC2A7409C40095926A /* TTTDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 033C30FB2A7409C40095926A /* TTTDictionary.m */; };
97-
033C31002A74CECE0095926A /* EZAppleDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 033C30FF2A74CECE0095926A /* EZAppleDictionary.m */; };
9898
033C6DBE2ED9C4F000AC39FC /* GoogleService+Translate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033C6DBD2ED9C4F000AC39FC /* GoogleService+Translate.swift */; };
9999
033C6DBF2ED9C4F000AC39FC /* GoogleService+Language.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033C6DBC2ED9C4F000AC39FC /* GoogleService+Language.swift */; };
100100
033C6DC42ED9D6D700AC39FC /* DeepLService+Translate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 033C6DC12ED9D6D700AC39FC /* DeepLService+Translate.swift */; };
@@ -568,7 +568,6 @@
568568
030D61242CD9B905000DF298 /* AcknowListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowListView.swift; sourceTree = "<group>"; };
569569
030D612B2CD9BB34000DF298 /* Pods-Easydict-acknowledgements.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Pods-Easydict-acknowledgements.plist"; path = "Pods/Target Support Files/Pods-Easydict/Pods-Easydict-acknowledgements.plist"; sourceTree = SOURCE_ROOT; };
570570
030D612D2CD9BBC3000DF298 /* Package.resolved */ = {isa = PBXFileReference; lastKnownFileType = text; name = Package.resolved; path = Easydict.xcworkspace/xcshareddata/swiftpm/Package.resolved; sourceTree = SOURCE_ROOT; };
571-
0310C8262A94EFA100B1D81E /* apple-dictionary.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "apple-dictionary.html"; sourceTree = "<group>"; };
572571
0311A5AB2E150522007AB02B /* OCRTextNormalizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OCRTextNormalizer.swift; sourceTree = "<group>"; };
573572
0312584E2E1802650072320C /* AppleLanguageDetectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleLanguageDetectorTests.swift; sourceTree = "<group>"; };
574573
031258502E18C4EA0072320C /* String+ToChinese.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+ToChinese.swift"; sourceTree = "<group>"; };
@@ -585,6 +584,8 @@
585584
031C66C82ED9EB290025D190 /* BingService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BingService.swift; sourceTree = "<group>"; };
586585
031C66C92ED9EB290025D190 /* BingService+Translate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BingService+Translate.swift"; sourceTree = "<group>"; };
587586
031C66CA2ED9EB290025D190 /* BingTranslateResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BingTranslateResponse.swift; sourceTree = "<group>"; };
587+
031C66D32ED9F9E30025D190 /* AppleDictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleDictionary.swift; sourceTree = "<group>"; };
588+
031C66D52ED9F9E40025D190 /* apple-dictionary.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "apple-dictionary.html"; sourceTree = "<group>"; };
588589
031CBA632CD76F1500364437 /* ChatMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessage.swift; sourceTree = "<group>"; };
589590
031DBD782AE01E130071CF85 /* easydict */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = easydict; sourceTree = "<group>"; };
590591
032041192E43BEB50065A05B /* ocr-en-text-4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ocr-en-text-4.png"; sourceTree = "<group>"; };
@@ -653,8 +654,6 @@
653654
033C30F92A7409C40095926A /* DictionaryKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryKit.h; sourceTree = "<group>"; };
654655
033C30FA2A7409C40095926A /* TTTDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTTDictionary.h; sourceTree = "<group>"; };
655656
033C30FB2A7409C40095926A /* TTTDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTTDictionary.m; sourceTree = "<group>"; };
656-
033C30FE2A74CECE0095926A /* EZAppleDictionary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EZAppleDictionary.h; sourceTree = "<group>"; };
657-
033C30FF2A74CECE0095926A /* EZAppleDictionary.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EZAppleDictionary.m; sourceTree = "<group>"; };
658657
033C6DBC2ED9C4F000AC39FC /* GoogleService+Language.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GoogleService+Language.swift"; sourceTree = "<group>"; };
659658
033C6DBD2ED9C4F000AC39FC /* GoogleService+Translate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GoogleService+Translate.swift"; sourceTree = "<group>"; };
660659
033C6DC02ED9D6D700AC39FC /* DeepLService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeepLService.swift; sourceTree = "<group>"; };
@@ -1404,6 +1403,15 @@
14041403
path = Bing;
14051404
sourceTree = "<group>";
14061405
};
1406+
031C66D72ED9F9F20025D190 /* AppleDictionary */ = {
1407+
isa = PBXGroup;
1408+
children = (
1409+
031C66D32ED9F9E30025D190 /* AppleDictionary.swift */,
1410+
031C66D52ED9F9E40025D190 /* apple-dictionary.html */,
1411+
);
1412+
path = AppleDictionary;
1413+
sourceTree = "<group>";
1414+
};
14071415
03247E37296AE8C800AFCD67 /* LoadingAnimationView */ = {
14081416
isa = PBXGroup;
14091417
children = (
@@ -1518,16 +1526,6 @@
15181526
path = DictionaryKit;
15191527
sourceTree = "<group>";
15201528
};
1521-
033C30FD2A74CEB10095926A /* AppleDictionary */ = {
1522-
isa = PBXGroup;
1523-
children = (
1524-
033C30FE2A74CECE0095926A /* EZAppleDictionary.h */,
1525-
033C30FF2A74CECE0095926A /* EZAppleDictionary.m */,
1526-
0310C8262A94EFA100B1D81E /* apple-dictionary.html */,
1527-
);
1528-
path = AppleDictionary;
1529-
sourceTree = "<group>";
1530-
};
15311529
033C6DC32ED9D6D700AC39FC /* DeepL */ = {
15321530
isa = PBXGroup;
15331531
children = (
@@ -1626,14 +1624,6 @@
16261624
path = Model;
16271625
sourceTree = "<group>";
16281626
};
1629-
03542A2D293645B800C34C33 /* Apple */ = {
1630-
isa = PBXGroup;
1631-
children = (
1632-
033C30FD2A74CEB10095926A /* AppleDictionary */,
1633-
);
1634-
path = Apple;
1635-
sourceTree = "<group>";
1636-
};
16371627
03542A312936F6FE00C34C33 /* Language */ = {
16381628
isa = PBXGroup;
16391629
children = (
@@ -1716,6 +1706,7 @@
17161706
031760F22E07FB2800CE8FD7 /* AppleSpeechService */,
17171707
031760E92E065DB300CE8FD7 /* AppleOCREngine */,
17181708
039785272CC678F400A49087 /* AppleTranslation */,
1709+
031C66D72ED9F9F20025D190 /* AppleDictionary */,
17191710
);
17201711
path = Apple;
17211712
sourceTree = "<group>";
@@ -2088,7 +2079,6 @@
20882079
033B7131293CE2010096E2DF /* WebViewTranslator */,
20892080
03542A362937AE2100C34C33 /* Model */,
20902081
03542A312936F6FE00C34C33 /* Language */,
2091-
03542A2D293645B800C34C33 /* Apple */,
20922082
03B0222C29231FA6001C7E63 /* Baidu */,
20932083
);
20942084
path = Service;
@@ -3553,7 +3543,6 @@
35533543
buildActionMask = 2147483647;
35543544
files = (
35553545
CA9CF8A72D2E6D3C000C1860 /* 人的一生_v4.json in Resources */,
3556-
0310C8272A94F5DF00B1D81E /* apple-dictionary.html in Resources */,
35573546
03BFBB802923A2FA00C48725 /* [email protected] in Resources */,
35583547
03538DF62D2652F7005E56A8 /* 美.json in Resources */,
35593548
031DBD792AE01E130071CF85 /* easydict in Resources */,
@@ -3581,6 +3570,7 @@
35813570
C4DE3D6D2AC00EB500C2B85D /* Localizable.xcstrings in Resources */,
35823571
CA9CF8A32D2E6CE6000C1860 /* good_v4.json in Resources */,
35833572
03BFBB662923998300C48725 /* [email protected] in Resources */,
3573+
031C66D62ED9F9E40025D190 /* apple-dictionary.html in Resources */,
35843574
03BFBB812923A2FA00C48725 /* [email protected] in Resources */,
35853575
03BFBB7D2923A1D900C48725 /* [email protected] in Resources */,
35863576
03538DF42D263FA5005E56A8 /* good.json in Resources */,
@@ -3935,6 +3925,7 @@
39353925
038A72402B62C0B9004995E3 /* String+Regex.swift in Sources */,
39363926
03D35DAA2AA6C49B00B023FE /* NSString+EZRegex.m in Sources */,
39373927
03B022FE29231FA6001C7E63 /* EZBaseQueryViewController.m in Sources */,
3928+
031C66D42ED9F9E30025D190 /* AppleDictionary.swift in Sources */,
39383929
03538DEE2D259280005E56A8 /* YoudaoTranslateResponese.swift in Sources */,
39393930
DC6D9C892B3969510055EFFC /* Appearance.swift in Sources */,
39403931
0396D611292C932F006A11D9 /* EZSelectLanguageCell.m in Sources */,
@@ -4090,7 +4081,6 @@
40904081
03CF2F752D87CF68006DC7E1 /* Screenshot+UserDefaults.swift in Sources */,
40914082
03675A3D2D7FE598004E780A /* ScreenshotOverlayView.swift in Sources */,
40924083
0357B95A2C04387D00A48CB0 /* TextEditorCell.swift in Sources */,
4093-
033C31002A74CECE0095926A /* EZAppleDictionary.m in Sources */,
40944084
03E2BF752A298F2B00E010F3 /* NSString+EZUtils.m in Sources */,
40954085
03B022F529231FA6001C7E63 /* EZDetectManager.m in Sources */,
40964086
);

Easydict/App/Easydict-Bridging-Header.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#import "EZBaiduTranslate.h"
2222
#import "MMCrash.h"
2323
#import "EZDetectManager.h"
24-
#import "EZAppleDictionary.h"
2524
#import "EZServiceTypes.h"
2625
#import "EZEventMonitor.h"
26+
#import "DictionaryKit.h"
27+
#import "NSString+EZHandleInputText.h"

0 commit comments

Comments
 (0)