Skip to content

Commit ac24e45

Browse files
committed
[Writing Tools] Support compiling ENABLE_WRITING_TOOLS on the public SDK (Part 7)
https://bugs.webkit.org/show_bug.cgi?id=291835 rdar://149657096 Reviewed by Abrar Rahman Protyasha and Megan Gardner. More work towards ENABLE_WRITING_TOOLS on the public SDK, this time primarily adding support for using Obj-C SPI from Swift. To do this, dummy Clang modules are created that use the PAL SPI forward declarations while linking the real frameworks. * Source/WebKit/Configurations/WebKitSwift.xcconfig: Adjust SWIFT_INCLUDE_PATHS and USER_HEADER_SEARCH_PATHS so that the modules are accessible from WKS. * Source/WebKit/Platform/spi/Cocoa/Modules/WritingTools/WritingToolsSPI.h: Added. * Source/WebKit/Platform/spi/Cocoa/Modules/WritingToolsUI/WritingToolsUISPI.h: Added. Add dummy "umbrella" headers corresponding to each framework, which just import the SPI declarations from PAL. * Source/WebKit/Platform/spi/Cocoa/Modules/WritingTools/module.modulemap: Added. * Source/WebKit/Platform/spi/Cocoa/Modules/WritingToolsUI/module.modulemap: Added. Create a Clang module for each of the frameworks, exporting everything inside their umbrella headers. * Source/WebKit/Platform/spi/ios/UIKit_SPI.swiftinterface: Drive-by fix: remove availability declarations so that watchOS and tvOS public SDK compile fine. * Source/WebKit/WebKit.xcodeproj/project.pbxproj: Add the new files. * Source/WebKit/WebKitSwift/TextAnimation/TextAnimationManager.swift: Drive-by fix: use ENABLE_WRITING_TOOLS for consistency, since `canImport(WritingTools)` is not true on the public SDK (since the module is "WritingTools_SPI"). * Source/WebKit/WebKitSwift/WritingTools/PlatformIntelligenceTextEffectView.swift: * Source/WebKit/WebKitSwift/WritingTools/WKIntelligenceReplacementTextEffectCoordinator.swift: * Source/WebKit/WebKitSwift/WritingTools/WKIntelligenceSmartReplyTextEffectCoordinator.swift: Import the dummy SPI modules when using the public SDK. Canonical link: https://commits.webkit.org/293940@main
1 parent 801e0c4 commit ac24e45

File tree

11 files changed

+171
-44
lines changed

11 files changed

+171
-44
lines changed

Source/WebKit/Configurations/WebKitSwift.xcconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ FRAMEWORK_LDFLAGS_xrsimulator[sdk=xr*2.*] = -framework LinearMediaKit;
6464

6565
// Use handwritten SPI modules on public SDKs.
6666
SWIFT_INCLUDE_PATHS = $(SWIFT_INCLUDE_PATHS_$(USE_INTERNAL_SDK));
67-
SWIFT_INCLUDE_PATHS_ = $(SRCROOT)/Platform/spi/visionos $(SRCROOT)/Platform/spi/ios $(inherited);
67+
SWIFT_INCLUDE_PATHS_ = $(SRCROOT)/Platform/spi/visionos $(SRCROOT)/Platform/spi/ios $(SRCROOT)/Platform/spi/Cocoa/Modules $(inherited);
68+
69+
USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/Platform/spi/Cocoa/Modules;
6870

6971
WEBKITSWIFT_HEADERS_FOLDER_PATH = $(WK_LIBRARY_HEADERS_FOLDER_PATH)/WebKitSwift;
7072

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (C) 2025 Apple Inc. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
// 1. Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// 2. Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
//
12+
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
13+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
16+
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22+
// THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
#pragma once
25+
26+
#import <pal/spi/cocoa/WritingToolsSPI.h>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (C) 2025 Apple Inc. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
// 1. Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// 2. Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
//
12+
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
13+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
16+
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22+
// THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
module WritingTools_SPI [system] {
25+
umbrella header "WritingToolsSPI.h"
26+
link framework "WritingTools"
27+
export *
28+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (C) 2025 Apple Inc. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
// 1. Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// 2. Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
//
12+
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
13+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
16+
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22+
// THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
#pragma once
25+
26+
#import <pal/spi/cocoa/WritingToolsUISPI.h>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (C) 2025 Apple Inc. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions
5+
// are met:
6+
// 1. Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
// 2. Redistributions in binary form must reproduce the above copyright
9+
// notice, this list of conditions and the following disclaimer in the
10+
// documentation and/or other materials provided with the distribution.
11+
//
12+
// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
13+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
16+
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
17+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
18+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
19+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
20+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
22+
// THE POSSIBILITY OF SUCH DAMAGE.
23+
24+
module WritingToolsUI_Private_SPI [system] {
25+
umbrella header "WritingToolsUISPI.h"
26+
link framework "WritingToolsUI"
27+
export *
28+
}

Source/WebKit/Platform/spi/ios/UIKit_SPI.swiftinterface

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,22 @@ import _Concurrency
44
import Foundation
55
import Swift
66
@_exported import UIKit
7-
@_inheritsConvenienceInitializers @available(iOS 18.0, visionOS 2.0, *)
8-
@available(tvOS, unavailable)
9-
@available(watchOS, unavailable)
7+
@_inheritsConvenienceInitializers
108
@objc open class UITextEffectTextChunk : ObjectiveC.NSObject, Swift.Identifiable {
119
@objc override dynamic public init()
12-
@available(iOS 18.0, visionOS 2.0, *)
13-
@available(tvOS, unavailable)
14-
@available(watchOS, unavailable)
1510
public typealias ID = Swift.ObjectIdentifier
1611
@objc deinit
1712
}
18-
@available(iOS 18.0, visionOS 2.0, *)
19-
@available(tvOS, unavailable)
20-
@available(watchOS, unavailable)
2113
@objc public protocol UITextEffectViewSource {
2214
@objc func targetedPreview(for chunk: UIKit_SPI.UITextEffectTextChunk) async -> UIKit.UITargetedPreview
2315
@objc optional func canGenerateTargetedPreviews() async -> Swift.Bool
2416
@objc optional func canGenerateTargetedPreviewForChunk(_: UIKit_SPI.UITextEffectTextChunk) async -> Swift.Bool
2517
@objc func updateTextChunkVisibilityForAnimation(_ chunk: UIKit_SPI.UITextEffectTextChunk, visible: Swift.Bool) async
2618
@objc optional func updatedTargetedPreviewGeometry(for chunk: UIKit_SPI.UITextEffectTextChunk, previous: CoreFoundation.CGRect) async -> CoreFoundation.CGRect
2719
}
28-
@objc @_hasMissingDesignatedInitializers @available(iOS 18.0, visionOS 2.0, *)
29-
@available(tvOS, unavailable)
30-
@available(watchOS, unavailable)
20+
@objc @_hasMissingDesignatedInitializers
3121
@_Concurrency.MainActor public class UITextEffectView : UIKit.UIView {
3222
@_Concurrency.MainActor weak public var source: (any UIKit_SPI.UITextEffectViewSource)?
33-
@available(iOS 18.1, visionOS 2.1, *)
34-
@available(tvOS, unavailable)
35-
@available(watchOS, unavailable)
3623
@_Concurrency.MainActor public var hasActiveEffects: Swift.Bool {
3724
get
3825
}
@@ -54,23 +41,14 @@ import Swift
5441
}
5542
@objc deinit
5643
}
57-
@available(iOS 18.0, visionOS 2.0, *)
58-
@available(tvOS, unavailable)
59-
@available(watchOS, unavailable)
6044
extension UIKit_SPI.UITextEffectView {
6145
@_Concurrency.MainActor public protocol TextEffect {
6246
@_Concurrency.MainActor var id: UIKit_SPI.UITextEffectView.EffectID { get }
6347
@_Concurrency.MainActor var chunk: UIKit_SPI.UITextEffectTextChunk { get }
6448
@_Concurrency.MainActor var view: UIKit_SPI.UITextEffectView? { get }
6549
}
6650
}
67-
@available(iOS 18.0, visionOS 2.0, *)
68-
@available(tvOS, unavailable)
69-
@available(watchOS, unavailable)
7051
extension UIKit_SPI.UITextEffectView {
71-
@available(iOS 18.0, visionOS 2.0, *)
72-
@available(tvOS, unavailable)
73-
@available(watchOS, unavailable)
7452
@_Concurrency.MainActor public class ReplacementTextEffect : UIKit_SPI.UITextEffectView.TextEffect {
7553
@_Concurrency.MainActor public var view: UIKit_SPI.UITextEffectView?
7654
@_Concurrency.MainActor public var chunk: UIKit_SPI.UITextEffectTextChunk
@@ -93,13 +71,7 @@ extension UIKit_SPI.UITextEffectView.ReplacementTextEffect.Delegate {
9371
public func performReplacementAndGeneratePreview(for chunk: UIKit_SPI.UITextEffectTextChunk, effect: UIKit_SPI.UITextEffectView.ReplacementTextEffect, animation: UIKit_SPI.UITextEffectView.ReplacementTextEffect.AnimationParameters) async -> UIKit.UITargetedPreview?
9472
public func performReplacement(for chunk: UIKit_SPI.UITextEffectTextChunk, effect: UIKit_SPI.UITextEffectView.ReplacementTextEffect, animation: UIKit_SPI.UITextEffectView.ReplacementTextEffect.AnimationParameters) async
9573
}
96-
@available(iOS 18.0, visionOS 2.0, *)
97-
@available(tvOS, unavailable)
98-
@available(watchOS, unavailable)
9974
extension UIKit_SPI.UITextEffectView {
100-
@available(iOS 18.0, visionOS 2.0, *)
101-
@available(tvOS, unavailable)
102-
@available(watchOS, unavailable)
10375
@_Concurrency.MainActor public class PonderingEffect : UIKit_SPI.UITextEffectView.TextEffect {
10476
@_Concurrency.MainActor final public let chunk: UIKit_SPI.UITextEffectTextChunk
10577
@_Concurrency.MainActor weak public var view: UIKit_SPI.UITextEffectView?
@@ -109,24 +81,16 @@ extension UIKit_SPI.UITextEffectView {
10981
@objc deinit
11082
}
11183
}
112-
@objc @_hasMissingDesignatedInitializers @available(iOS 18.0, visionOS 2.0, *)
113-
@available(tvOS, unavailable)
114-
@available(watchOS, unavailable)
84+
@objc @_hasMissingDesignatedInitializers
11585
@_Concurrency.MainActor public class UIDirectionalLightEffectView : UIKit.UIView {
11686
@objc deinit
11787
}
118-
@available(iOS 18.0, visionOS 2.0, *)
119-
@available(tvOS, unavailable)
120-
@available(watchOS, unavailable)
12188
extension UIKit_SPI.UIDirectionalLightEffectView {
12289
public struct Configuration {
12390
public let fillColor: UIKit.UIColor
12491
public static let pondering: UIKit_SPI.UIDirectionalLightEffectView.Configuration
12592
}
12693
}
127-
@available(iOS 18.1, visionOS 2.1, *)
128-
@available(tvOS, unavailable)
129-
@available(watchOS, unavailable)
13094
extension UIKit.UIColor {
13195
public static var ponderingFill: UIKit.UIColor {
13296
get

Source/WebKit/WebKit.xcodeproj/project.pbxproj

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3195,6 +3195,10 @@
31953195
07275C832D00F782002315A5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
31963196
07275C8E2D011396002315A5 /* Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Empty.swift; sourceTree = "<group>"; };
31973197
0728820E2DB53C02006F4A2B /* UIKit_SPI.swiftinterface */ = {isa = PBXFileReference; lastKnownFileType = text; path = UIKit_SPI.swiftinterface; sourceTree = "<group>"; };
3198+
0728821D2DB58B3F006F4A2B /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
3199+
0728821E2DB58B48006F4A2B /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
3200+
072882262DB5C2A1006F4A2B /* WritingToolsSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WritingToolsSPI.h; sourceTree = "<group>"; };
3201+
072882272DB5C34C006F4A2B /* WritingToolsUISPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WritingToolsUISPI.h; sourceTree = "<group>"; };
31983202
07297F9C1C1711EA003F0735 /* DeviceIdHashSaltStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceIdHashSaltStorage.cpp; sourceTree = "<group>"; };
31993203
07297F9C1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionCheckProxy.cpp; sourceTree = "<group>"; };
32003204
07297F9D1C17BBEA003F0735 /* UserMediaPermissionCheckProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserMediaPermissionCheckProxy.h; sourceTree = "<group>"; };
@@ -8515,7 +8519,6 @@
85158519
FA580B102DA64085005E4965 /* UnifiedSource158.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource158.cpp; sourceTree = "<group>"; };
85168520
FA580B112DA64085005E4965 /* UnifiedSource159.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource159.cpp; sourceTree = "<group>"; };
85178521
FA580B122DA64085005E4965 /* UnifiedSource160.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UnifiedSource160.cpp; sourceTree = "<group>"; };
8518-
FA580B272DA64B5F005E4965 /* UnifiedSource161.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource161.cpp; path = "UnifiedSource161.cpp"; sourceTree = "<group>"; };
85198522
FA580B282DA64B5F005E4965 /* UnifiedSource162.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource162.cpp; path = "UnifiedSource162.cpp"; sourceTree = "<group>"; };
85208523
FA580B292DA64B5F005E4965 /* UnifiedSource163.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource163.cpp; path = "UnifiedSource163.cpp"; sourceTree = "<group>"; };
85218524
FA580B2A2DA64B5F005E4965 /* UnifiedSource164.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = UnifiedSource164.cpp; path = "UnifiedSource164.cpp"; sourceTree = "<group>"; };
@@ -8785,6 +8788,33 @@
87858788
path = _WebKit_SwiftUI;
87868789
sourceTree = "<group>";
87878790
};
8791+
0728821A2DB58AA3006F4A2B /* Modules */ = {
8792+
isa = PBXGroup;
8793+
children = (
8794+
0728821B2DB58AC2006F4A2B /* WritingTools */,
8795+
0728821C2DB58AFD006F4A2B /* WritingToolsUI */,
8796+
);
8797+
path = Modules;
8798+
sourceTree = "<group>";
8799+
};
8800+
0728821B2DB58AC2006F4A2B /* WritingTools */ = {
8801+
isa = PBXGroup;
8802+
children = (
8803+
0728821D2DB58B3F006F4A2B /* module.modulemap */,
8804+
072882262DB5C2A1006F4A2B /* WritingToolsSPI.h */,
8805+
);
8806+
path = WritingTools;
8807+
sourceTree = "<group>";
8808+
};
8809+
0728821C2DB58AFD006F4A2B /* WritingToolsUI */ = {
8810+
isa = PBXGroup;
8811+
children = (
8812+
0728821E2DB58B48006F4A2B /* module.modulemap */,
8813+
072882272DB5C34C006F4A2B /* WritingToolsUISPI.h */,
8814+
);
8815+
path = WritingToolsUI;
8816+
sourceTree = "<group>";
8817+
};
87888818
0736B752260D039F00E06994 /* MediaSession */ = {
87898819
isa = PBXGroup;
87908820
children = (
@@ -11771,6 +11801,7 @@
1177111801
3754D5411B3A2998003A4C7F /* Cocoa */ = {
1177211802
isa = PBXGroup;
1177311803
children = (
11804+
0728821A2DB58AA3006F4A2B /* Modules */,
1177411805
E3CAAA432413278A00CED2E2 /* AccessibilitySupportSPI.h */,
1177511806
E3B8F7F72BA8AC4D006E97B6 /* AccessibilityUtilitiesSPI.h */,
1177611807
9565083726D87A2B00E15CB7 /* AppleMediaServicesSPI.h */,

Source/WebKit/WebKitSwift/TextAnimation/TextAnimationManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Copyright (C) 2024 Apple Inc. All rights reserved.
33
//
44

5-
#if canImport(WritingTools) && canImport(UIKit)
5+
#if ENABLE_WRITING_TOOLS && canImport(UIKit)
66

77
import OSLog
88
import WebKit

Source/WebKit/WebKitSwift/WritingTools/PlatformIntelligenceTextEffectView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ import Foundation
3030
import AppKit
3131
// WritingToolsUI is not present in the base system, but WebKit is, so it must be weak-linked.
3232
// WritingToolsUI need not be soft-linked from WebKitSwift because although WTUI links WebKit, WebKit does not directly link WebKitSwift.
33+
#if USE_APPLE_INTERNAL_SDK
3334
@_weakLinked internal import WritingToolsUI_Private._WTTextEffectView
3435
@_weakLinked internal import WritingToolsUI_Private._WTSweepTextEffect
3536
@_weakLinked internal import WritingToolsUI_Private._WTReplaceTextEffect
37+
#else
38+
@_weakLinked internal import WritingToolsUI_Private_SPI
39+
#endif // USE_APPLE_INTERNAL_SDK
3640

3741
#else
3842

Source/WebKit/WebKitSwift/WritingTools/WKIntelligenceReplacementTextEffectCoordinator.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ import Foundation
2727
import WebKit
2828
import WebKitSwift
2929
@_spi(Private) import WebKit
30+
31+
#if USE_APPLE_INTERNAL_SDK
3032
@_spiOnly import WritingTools
33+
#else
34+
@_spiOnly import WritingTools_SPI
35+
#endif
3136

3237
#if os(macOS)
38+
#if USE_APPLE_INTERNAL_SDK
3339
@_weakLinked internal import WritingToolsUI_Private._WTTextEffectView
34-
#endif
40+
#else
41+
@_weakLinked internal import WritingToolsUI_Private_SPI
42+
#endif // USE_APPLE_INTERNAL_SDK
43+
#endif // os(macOS)
3544

3645
// MARK: Implementation
3746

0 commit comments

Comments
 (0)