From ab5f972886c728e26f9d50c1b2b2e2d92bb41d72 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:58:55 +0100 Subject: [PATCH 1/6] refactor(ios)!: remove deprecated bridge APIs Removes the deprecated CAPBridgeProtocol requirements (getWebView, isSimulator, isDevMode, getStatusBarVisible/Style, getUserInterfaceStyle, getLocalUrl, getSavedCall, releaseCall(callbackId:), presentVC, dismissVC, modulePrint, setStatusBar* helpers) and their CapacitorBridge implementations, the deprecated CapacitorBridge convenience initializer taking cordovaConfiguration, and the unused httpsInterceptorStartIdentifier constant. Use the property accessors, savedCall(withID:)/releaseCall(withID:), viewController?.present/dismiss, and CAPLog instead. --- .../Capacitor/CAPBridgeProtocol.swift | 57 -------------- ios/Capacitor/Capacitor/CapacitorBridge.swift | 74 +------------------ .../CapacitorTests/CapacitorTests.swift | 7 +- 3 files changed, 10 insertions(+), 128 deletions(-) diff --git a/ios/Capacitor/Capacitor/CAPBridgeProtocol.swift b/ios/Capacitor/Capacitor/CAPBridgeProtocol.swift index 98ac66d965..47c463f03c 100644 --- a/ios/Capacitor/Capacitor/CAPBridgeProtocol.swift +++ b/ios/Capacitor/Capacitor/CAPBridgeProtocol.swift @@ -15,34 +15,6 @@ import WebKit var statusBarStyle: UIStatusBarStyle { get set } var statusBarAnimation: UIStatusBarAnimation { get set } - // MARK: - Deprecated - @available(*, deprecated, renamed: "webView") - func getWebView() -> WKWebView? - - @available(*, deprecated, renamed: "isSimEnvironment") - func isSimulator() -> Bool - - @available(*, deprecated, renamed: "isDevEnvironment") - func isDevMode() -> Bool - - @available(*, deprecated, renamed: "statusBarVisible") - func getStatusBarVisible() -> Bool - - @available(*, deprecated, renamed: "statusBarStyle") - func getStatusBarStyle() -> UIStatusBarStyle - - @available(*, deprecated, renamed: "userInterfaceStyle") - func getUserInterfaceStyle() -> UIUserInterfaceStyle - - @available(*, deprecated, message: "Moved - equivalent is found on config.localURL") - func getLocalUrl() -> String - - @available(*, deprecated, renamed: "savedCall(withID:)") - func getSavedCall(_ callbackId: String) -> CAPPluginCall? - - @available(*, deprecated, renamed: "releaseCall(withID:)") - func releaseCall(callbackId: String) - // MARK: - Plugin Access func plugin(withName: String) -> CAPPlugin? @@ -84,46 +56,17 @@ import WebKit // MARK: - View Presentation func showAlertWith(title: String, message: String, buttonTitle: String) - @available(*, deprecated, message: "Use self?.bridge?.viewController?.present") - func presentVC(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)?) - @available(*, deprecated, message: "Use self?.bridge?.viewController?.dismiss") - func dismissVC(animated flag: Bool, completion: (() -> Void)?) } /* Extensions to Obj-C protocols are not exposed to Obj-C code because of limitations in the runtime. Therefore these methods are implicitly Swift-only. - - The deprecated methods are declared here because they can be defined without colliding with the synthesized Obj-C setters - for the respective properties (e.g. `setStatusBarVisible:` for 'statusBarVisible`). */ extension CAPBridgeProtocol { - // variadic parameters cannot be exposed to Obj-C - @available(*, deprecated, message: "Use CAPLog directly") - public func modulePrint(_ plugin: CAPPlugin, _ items: Any...) { - let output = items.map { String(describing: $0) }.joined(separator: " ") - CAPLog.print("⚡️ ", plugin.pluginId, "-", output) - } - // default arguments are not permitted in protocol declarations public func alert(_ title: String, _ message: String, _ buttonTitle: String = "OK") { showAlertWith(title: title, message: message, buttonTitle: buttonTitle) } - - @available(*, deprecated, renamed: "statusBarVisible") - public func setStatusBarVisible(_ visible: Bool) { - statusBarVisible = visible - } - - @available(*, deprecated, renamed: "statusBarStyle") - public func setStatusBarStyle(_ style: UIStatusBarStyle) { - statusBarStyle = style - } - - @available(*, deprecated, renamed: "statusBarAnimation") - public func setStatusBarAnimation(_ animation: UIStatusBarAnimation) { - statusBarAnimation = animation - } } /* diff --git a/ios/Capacitor/Capacitor/CapacitorBridge.swift b/ios/Capacitor/Capacitor/CapacitorBridge.swift index de2beb22e3..8066994f29 100644 --- a/ios/Capacitor/Capacitor/CapacitorBridge.swift +++ b/ios/Capacitor/Capacitor/CapacitorBridge.swift @@ -95,8 +95,6 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { public static let capacitorSite = "https://capacitorjs.com/" public static let fileStartIdentifier = "/_capacitor_file_" public static let httpInterceptorStartIdentifier = "/_capacitor_http_interceptor_" - @available(*, deprecated, message: "`httpsInterceptorStartIdentifier` is no longer required. All proxied requests are handled via `httpInterceptorStartIdentifier` instead") - public static let httpsInterceptorStartIdentifier = "/_capacitor_https_interceptor_" public static let httpInterceptorUrlParam = "u" public static let defaultScheme = "capacitor" @@ -125,47 +123,6 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { // Array of block based observers var observers: [NSObjectProtocol] = [] - // MARK: - CAPBridgeProtocol: Deprecated - - public func getWebView() -> WKWebView? { - return webView - } - - public func isSimulator() -> Bool { - return isSimEnvironment - } - - public func isDevMode() -> Bool { - return isDevEnvironment - } - - public func getStatusBarVisible() -> Bool { - return statusBarVisible - } - - @nonobjc public func setStatusBarVisible(_ visible: Bool) { - statusBarVisible = visible - } - - public func getStatusBarStyle() -> UIStatusBarStyle { - return statusBarStyle - } - @nonobjc public func setStatusBarStyle(_ style: UIStatusBarStyle) { - statusBarStyle = style - } - - public func getUserInterfaceStyle() -> UIUserInterfaceStyle { - return userInterfaceStyle - } - - public func getLocalUrl() -> String { - return config.localURL.absoluteString - } - - @nonobjc public func setStatusBarAnimation(_ animation: UIStatusBarAnimation) { - statusBarAnimation = animation - } - public func setServerBasePath(_ path: String) { let url = URL(fileURLWithPath: path, isDirectory: true) guard FileManager.default.fileExists(atPath: url.path) else { return } @@ -198,11 +155,6 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { // MARK: - Initialization - @available(*, deprecated, renamed: "init", message: "Use different init") - public convenience init(with configuration: InstanceConfiguration, delegate bridgeDelegate: CAPBridgeDelegate, cordovaConfiguration: Any, assetHandler: WebViewAssetHandler, delegationHandler: WebViewDelegationHandler, autoRegisterPlugins: Bool = true) { - self.init(with: configuration, delegate: bridgeDelegate, assetHandler: assetHandler, delegationHandler: delegationHandler, autoRegisterPlugins: autoRegisterPlugins) - } - public init(with configuration: InstanceConfiguration, delegate bridgeDelegate: CAPBridgeDelegate, assetHandler: WebViewAssetHandler, delegationHandler: WebViewDelegationHandler, autoRegisterPlugins: Bool = true) { self.bridgeDelegate = bridgeDelegate @@ -403,16 +355,6 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { _ = storedCalls.withLock { $0.removeValue(forKey: withID) } } - // MARK: - Deprecated Versions - - @objc public func getSavedCall(_ callbackId: String) -> CAPPluginCall? { - return savedCall(withID: callbackId) - } - - @objc public func releaseCall(callbackId: String) { - releaseCall(withID: callbackId) - } - // MARK: - Internal func getDispatchQueue() -> DispatchQueue { @@ -420,7 +362,7 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { } func reload() { - self.getWebView()?.reload() + self.webView?.reload() } func docLink(_ url: String) -> String { @@ -589,7 +531,7 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { """ DispatchQueue.main.async { - self.getWebView()?.evaluateJavaScript(wrappedJs, completionHandler: { (_, error) in + self.webView?.evaluateJavaScript(wrappedJs, completionHandler: { (_, error) in if let error = error { CAPLog.print("⚡️ JS Eval error", error.localizedDescription) } @@ -605,7 +547,7 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { // swiftlint:disable:next identifier_name @objc public func eval(js: String) { DispatchQueue.main.async { - self.getWebView()?.evaluateJavaScript(js, completionHandler: { (_, error) in + self.webView?.evaluateJavaScript(js, completionHandler: { (_, error) in if let error = error { CAPLog.print("⚡️ JS Eval error", error.localizedDescription) } @@ -639,7 +581,7 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { public func logToJs(_ message: String, _ level: String = "log") { DispatchQueue.main.async { - self.getWebView()?.evaluateJavaScript("window.Capacitor.logJs('\(message)', '\(level)')") { (result, error) in + self.webView?.evaluateJavaScript("window.Capacitor.logJs('\(message)', '\(level)')") { (result, error) in if error != nil, let result = result { CAPLog.print(result) } @@ -695,12 +637,4 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol { alert.addAction(UIAlertAction(title: buttonTitle, style: UIAlertAction.Style.default, handler: nil)) self.viewController?.present(alert, animated: true, completion: nil) } - - @objc open func presentVC(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Void)? = nil) { - self.viewController?.present(viewControllerToPresent, animated: flag, completion: completion) - } - - @objc open func dismissVC(animated flag: Bool, completion: (() -> Void)? = nil) { - self.viewController?.dismiss(animated: flag, completion: completion) - } } diff --git a/ios/Capacitor/CapacitorTests/CapacitorTests.swift b/ios/Capacitor/CapacitorTests/CapacitorTests.swift index bd89d326bb..45427ea3a7 100644 --- a/ios/Capacitor/CapacitorTests/CapacitorTests.swift +++ b/ios/Capacitor/CapacitorTests/CapacitorTests.swift @@ -23,7 +23,12 @@ class CapacitorTests: XCTestCase { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. let descriptor = InstanceDescriptor.init() - bridge = MockBridge(with: InstanceConfiguration(with: descriptor, isDebug: true), delegate: MockBridgeViewController(), cordovaConfiguration: descriptor.cordovaConfiguration, assetHandler: MockAssetHandler(router: CapacitorRouter()), delegationHandler: MockDelegationHandler()) + bridge = MockBridge( + with: InstanceConfiguration(with: descriptor, isDebug: true), + delegate: MockBridgeViewController(), + assetHandler: MockAssetHandler(router: CapacitorRouter()), + delegationHandler: MockDelegationHandler() + ) } override func tearDown() { From 92e472fbcfda8f79ccdb07050e5b2e26976f2058 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:58:55 +0100 Subject: [PATCH 2/6] refactor(ios)!: remove deprecated CAPNotifications enum Use the Notification.Name.capacitor* constants instead. --- .../Capacitor/CAPNotifications.swift | 37 +------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/ios/Capacitor/Capacitor/CAPNotifications.swift b/ios/Capacitor/Capacitor/CAPNotifications.swift index 03d80aa87b..45b80f7940 100644 --- a/ios/Capacitor/Capacitor/CAPNotifications.swift +++ b/ios/Capacitor/Capacitor/CAPNotifications.swift @@ -1,8 +1,7 @@ /** Notificaton types for NotificationCenter and NSNotificationCenter - We want to include `capacitor` in the name(s) to uniquely identify these even though it can make the names long - and the deprecated notifications are only here for backwards compatibility. + We want to include `capacitor` in the name(s) to uniquely identify these even though it can make the names long. */ // swiftlint:disable identifier_name extension Notification.Name { @@ -32,38 +31,4 @@ extension Notification.Name { public static let capacitorViewWillTransition = Notification.Name.capacitorViewWillTransition } -/** - Deprecated, will be removed - */ -@objc public enum CAPNotifications: Int { - @available(*, deprecated, message: "renamed to 'Notification.Name.capacitorOpenURL'") - case URLOpen - @available(*, deprecated, message: "renamed to 'Notification.Name.capacitorOpenUniversalLink'") - case UniversalLinkOpen - @available(*, deprecated, message: "Notification.Name.capacitorContinueActivity'") - case ContinueActivity - @available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDidRegisterForRemoteNotifications'") - case DidRegisterForRemoteNotificationsWithDeviceToken - @available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDidFailToRegisterForRemoteNotifications'") - case DidFailToRegisterForRemoteNotificationsWithError - @available(*, deprecated, message: "renamed to 'Notification.Name.capacitorDecidePolicyForNavigationAction'") - case DecidePolicyForNavigationAction - - public func name() -> String { - switch self { - case .URLOpen: - return Notification.Name.capacitorOpenURL.rawValue - case .UniversalLinkOpen: - return Notification.Name.capacitorOpenUniversalLink.rawValue - case .ContinueActivity: - return Notification.Name.capacitorContinueActivity.rawValue - case .DidRegisterForRemoteNotificationsWithDeviceToken: - return Notification.Name.capacitorDidRegisterForRemoteNotifications.rawValue - case .DidFailToRegisterForRemoteNotificationsWithError: - return Notification.Name.capacitorDidFailToRegisterForRemoteNotifications.rawValue - case .DecidePolicyForNavigationAction: - return Notification.Name.capacitorDecidePolicyForNavigationAction.rawValue - } - } -} // swiftlint:enable identifier_name From e1fe39d497b0390611ecd980fc8b077835256979 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:58:55 +0100 Subject: [PATCH 3/6] refactor(ios)!: remove deprecated plugin call typealiases, hasOption and JSDate PluginCallErrorData, PluginResultData and JSResultBody are replaced by PluginCallResultData. hasOption is replaced by the typed accessors and JSDate.toString is no longer needed since dates are mapped to strings during serialization. --- ios/Capacitor/Capacitor/CAPPluginCall.swift | 13 ------------- ios/Capacitor/Capacitor/JS.swift | 11 ----------- 2 files changed, 24 deletions(-) diff --git a/ios/Capacitor/Capacitor/CAPPluginCall.swift b/ios/Capacitor/Capacitor/CAPPluginCall.swift index b4ae0eb447..24d16a9e40 100644 --- a/ios/Capacitor/Capacitor/CAPPluginCall.swift +++ b/ios/Capacitor/Capacitor/CAPPluginCall.swift @@ -1,10 +1,5 @@ import Foundation -@available(*, deprecated, renamed: "PluginCallResultData") -public typealias PluginCallErrorData = [String: Any] -@available(*, deprecated, renamed: "PluginCallResultData") -public typealias PluginResultData = [String: Any] - /** * Swift niceties for CAPPluginCall */ @@ -26,14 +21,6 @@ extension CAPPluginCall: JSValueContainer { } @objc public extension CAPPluginCall { - @available(*, deprecated, message: "Presence of a key should not be considered significant. Use typed accessors to check the value instead.") - func hasOption(_ key: String) -> Bool { - guard let value = options[key] else { - return false - } - return !(value is NSNull) - } - func resolve() { successHandler(CAPPluginCallResult(nil), self) } diff --git a/ios/Capacitor/Capacitor/JS.swift b/ios/Capacitor/Capacitor/JS.swift index b1198b1786..52cae13791 100644 --- a/ios/Capacitor/Capacitor/JS.swift +++ b/ios/Capacitor/Capacitor/JS.swift @@ -1,16 +1,5 @@ import Foundation -public class JSDate { - @available(*, deprecated, message: "No longer needed. Dates will be mapped to strings during serialization.") - static func toString(_ date: Date) -> String { - let formatter = ISO8601DateFormatter() - return formatter.string(from: date) - } -} - -@available(*, deprecated, renamed: "PluginCallResultData") -public typealias JSResultBody = [String: Any] - /** * A call originating from JavaScript land */ From 78c5700170699e1038f91a03a48afc95622d471f Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:59:20 +0100 Subject: [PATCH 4/6] refactor(ios)!: remove deprecated configuration accessors Removes InstanceConfiguration.getPluginConfigValue, getValue and getString along with CAPPlugin.getConfigValue: which depended on them. Use getPluginConfig(_:) and the direct configuration property accessors instead. --- .../Capacitor/CAPInstanceConfiguration.swift | 15 ------------- ios/Capacitor/Capacitor/CAPPlugin.h | 1 - ios/Capacitor/Capacitor/CAPPlugin.m | 4 ---- .../CapacitorTests/ConfigurationTests.swift | 21 ++++++++++--------- 4 files changed, 11 insertions(+), 30 deletions(-) diff --git a/ios/Capacitor/Capacitor/CAPInstanceConfiguration.swift b/ios/Capacitor/Capacitor/CAPInstanceConfiguration.swift index 625a1fae75..7b1aff6316 100644 --- a/ios/Capacitor/Capacitor/CAPInstanceConfiguration.swift +++ b/ios/Capacitor/Capacitor/CAPInstanceConfiguration.swift @@ -23,11 +23,6 @@ extension InstanceConfiguration { return localURL.appendingPathComponent(errorPath) } - @available(*, deprecated, message: "Use getPluginConfig") - @objc public func getPluginConfigValue(_ pluginId: String, _ configKey: String) -> Any? { - return (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId).\(configKey)")] - } - @objc public func getPluginConfig(_ pluginId: String) -> PluginConfig { if let cfg = (pluginConfigurations as? JSObject)?[keyPath: KeyPath("\(pluginId)")] as? JSObject { return PluginConfig(config: cfg) @@ -44,16 +39,6 @@ extension InstanceConfiguration { return false } - @available(*, deprecated, message: "Use direct property accessors") - @objc public func getValue(_ key: String) -> Any? { - return (legacyConfig as? JSObject)?[keyPath: KeyPath(key)] - } - - @available(*, deprecated, message: "Use direct property accessors") - @objc public func getString(_ key: String) -> String? { - return (legacyConfig as? JSObject)?[keyPath: KeyPath(key)] as? String - } - // MARK: - Private private func doesHost(_ host: String, match pattern: String) -> Bool { diff --git a/ios/Capacitor/Capacitor/CAPPlugin.h b/ios/Capacitor/Capacitor/CAPPlugin.h index 944bb35004..f22d9be2a0 100644 --- a/ios/Capacitor/Capacitor/CAPPlugin.h +++ b/ios/Capacitor/Capacitor/CAPPlugin.h @@ -51,7 +51,6 @@ -(NSString* _Nonnull)getId; -(BOOL)getBool:(CAPPluginCall* _Nonnull) call field:(NSString* _Nonnull)field defaultValue:(BOOL)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations."); -(NSString* _Nullable)getString:(CAPPluginCall* _Nonnull)call field:(NSString* _Nonnull)field defaultValue:(NSString* _Nonnull)defaultValue DEPRECATED_MSG_ATTRIBUTE("Use accessors on CAPPluginCall instead. See CAPBridgedJSTypes.h for Obj-C implementations."); --(id _Nullable)getConfigValue:(NSString* _Nonnull)key __deprecated_msg("use getConfig() and access config values using the methods available depending on the type."); -(PluginConfig* _Nonnull)getConfig; -(void)setCenteredPopover:(UIViewController* _Nonnull) vc; -(void)setCenteredPopover:(UIViewController* _Nonnull) vc size:(CGSize) size; diff --git a/ios/Capacitor/Capacitor/CAPPlugin.m b/ios/Capacitor/Capacitor/CAPPlugin.m index afa7c9a8b2..92bf24e7dd 100644 --- a/ios/Capacitor/Capacitor/CAPPlugin.m +++ b/ios/Capacitor/Capacitor/CAPPlugin.m @@ -29,10 +29,6 @@ - (NSString *) getString:(CAPPluginCall *)call field:(NSString *)field defaultVa return [call getString:field defaultValue:defaultValue]; } --(id)getConfigValue:(NSString *)key __deprecated { - return [self.bridge.config getPluginConfigValue:self.pluginName :key]; -} - -(PluginConfig*)getConfig { return [self.bridge.config getPluginConfig:self.pluginName]; } diff --git a/ios/Capacitor/CapacitorTests/ConfigurationTests.swift b/ios/Capacitor/CapacitorTests/ConfigurationTests.swift index 177f211e7d..ca67ec0c6d 100644 --- a/ios/Capacitor/CapacitorTests/ConfigurationTests.swift +++ b/ios/Capacitor/CapacitorTests/ConfigurationTests.swift @@ -134,19 +134,20 @@ class ConfigurationTests: XCTestCase { let url = Bundle.main.url(forResource: "configurations", withExtension: "")! let descriptor = InstanceDescriptor.init(at: url, configuration: ConfigurationTests.files[.flat], cordovaConfiguration: nil) let configuration = InstanceConfiguration(with: descriptor, isDebug: true) - let value = configuration.getPluginConfigValue("SplashScreen", "launchShowDuration") as? Int - XCTAssertNotNil(value) - XCTAssertTrue(value == 1) + let value = configuration.getPluginConfig("SplashScreen").getInt("launchShowDuration", 0) + XCTAssertEqual(value, 1) } - + func testLegacyConfig() throws { let url = Bundle.main.url(forResource: "configurations", withExtension: "")! - let descriptor = InstanceDescriptor.init(at: url, configuration: ConfigurationTests.files[.nested], cordovaConfiguration: nil) - let configuration = InstanceConfiguration(with: descriptor, isDebug: true) - var value = configuration.getValue("overrideUserAgent") as? String - XCTAssertEqual(value, "level 1 override") - value = configuration.getValue("ios.overrideUserAgent") as? String - XCTAssertEqual(value, "level 2 override") + // a top-level legacy key is exposed through the direct property accessor + let flatDescriptor = InstanceDescriptor.init(at: url, configuration: ConfigurationTests.files[.flat], cordovaConfiguration: nil) + let flatConfiguration = InstanceConfiguration(with: flatDescriptor, isDebug: true) + XCTAssertEqual(flatConfiguration.overridenUserAgentString, "level 1 override") + // a platform-specific legacy key overrides the top-level one + let nestedDescriptor = InstanceDescriptor.init(at: url, configuration: ConfigurationTests.files[.nested], cordovaConfiguration: nil) + let nestedConfiguration = InstanceConfiguration(with: nestedDescriptor, isDebug: true) + XCTAssertEqual(nestedConfiguration.overridenUserAgentString, "level 2 override") } func testNavigationRules() throws { From 3b405ea2a07071db073743f95b56dfa9e89b8269 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:59:20 +0100 Subject: [PATCH 5/6] refactor(ios)!: remove deprecated setRequestHeaders overload The [String: String] overload is replaced by the [String: Any] version. Note the replacement uses setValue instead of addValue, so repeated keys overwrite rather than append. --- .../Capacitor/Plugins/CapacitorUrlRequest.swift | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ios/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift b/ios/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift index 2387f9935a..05d26554ec 100644 --- a/ios/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift +++ b/ios/Capacitor/Capacitor/Plugins/CapacitorUrlRequest.swift @@ -195,15 +195,6 @@ open class CapacitorUrlRequest: NSObject, URLSessionTaskDelegate { } } - @available(*, deprecated, message: "Use newer function with passed headers of type [String: Any]") - public func setRequestHeaders(_ headers: [String: String]) { - headers.keys.forEach { (key: String) in - let value = headers[key] - request.addValue(value!, forHTTPHeaderField: key) - self.headers[key] = value - } - } - public func setRequestHeaders(_ headers: [String: Any]) { headers.keys.forEach { (key: String) in let value = headers[key] From 0d9d8f2bb5d1fa653ce1be557476ee0a0a762049 Mon Sep 17 00:00:00 2001 From: Andre Destro Date: Wed, 5 Aug 2026 14:59:20 +0100 Subject: [PATCH 6/6] refactor(ios)!: remove CAPBridge and CAPFileManager compat classes CAPBridge was a deprecated compatibility shim: statusBarTappedNotification moved to Notification.Name.capacitorStatusBarTapped, and getLastUrl plus the application delegate helpers (handleOpenUrl, handleContinueActivity) moved to ApplicationDelegateProxy.shared. CAPFileManager.getPortablePath is replaced by portablePath(fromLocalURL:) on the bridge. --- .../Capacitor.xcodeproj/project.pbxproj | 8 ------ ios/Capacitor/Capacitor/CAPBridge.swift | 25 ------------------- ios/Capacitor/Capacitor/CAPFile.swift | 14 ----------- 3 files changed, 47 deletions(-) delete mode 100644 ios/Capacitor/Capacitor/CAPBridge.swift delete mode 100644 ios/Capacitor/Capacitor/CAPFile.swift diff --git a/ios/Capacitor/Capacitor.xcodeproj/project.pbxproj b/ios/Capacitor/Capacitor.xcodeproj/project.pbxproj index b0225252c0..e84fe73cb1 100644 --- a/ios/Capacitor/Capacitor.xcodeproj/project.pbxproj +++ b/ios/Capacitor/Capacitor.xcodeproj/project.pbxproj @@ -36,7 +36,6 @@ 62959B172524DA7800A3D7F1 /* JSExport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959AE32524DA7700A3D7F1 /* JSExport.swift */; }; 62959B192524DA7800A3D7F1 /* CAPBridgedPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 62959AE52524DA7700A3D7F1 /* CAPBridgedPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; 62959B1A2524DA7800A3D7F1 /* CAPPluginCall.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959AE62524DA7700A3D7F1 /* CAPPluginCall.swift */; }; - 62959B1B2524DA7800A3D7F1 /* CAPFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959AE72524DA7700A3D7F1 /* CAPFile.swift */; }; 62959B1C2524DA7800A3D7F1 /* CAPPluginMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = 62959AE82524DA7700A3D7F1 /* CAPPluginMethod.m */; }; 62959B1D2524DA7800A3D7F1 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959AE92524DA7700A3D7F1 /* UIColor.swift */; }; 62959B222524DA7800A3D7F1 /* Console.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959AEF2524DA7700A3D7F1 /* Console.swift */; }; @@ -54,7 +53,6 @@ 62959B422524DA7800A3D7F1 /* DocLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959B102524DA7700A3D7F1 /* DocLinks.swift */; }; 62959B432524DA7800A3D7F1 /* Data+Capacitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959B112524DA7700A3D7F1 /* Data+Capacitor.swift */; }; 62959B452524DA7800A3D7F1 /* CAPPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 62959B132524DA7700A3D7F1 /* CAPPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 62959B462524DA7800A3D7F1 /* CAPBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959B142524DA7700A3D7F1 /* CAPBridge.swift */; }; 62959B472524DA7800A3D7F1 /* CAPNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62959B152524DA7700A3D7F1 /* CAPNotifications.swift */; }; 6296A77E253A2E49005A202A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6296A77D253A2E49005A202A /* AppDelegate.swift */; }; 6296A782253A2E49005A202A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6296A781253A2E49005A202A /* ViewController.swift */; }; @@ -177,7 +175,6 @@ 62959AE32524DA7700A3D7F1 /* JSExport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSExport.swift; sourceTree = ""; }; 62959AE52524DA7700A3D7F1 /* CAPBridgedPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPBridgedPlugin.h; sourceTree = ""; }; 62959AE62524DA7700A3D7F1 /* CAPPluginCall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CAPPluginCall.swift; sourceTree = ""; }; - 62959AE72524DA7700A3D7F1 /* CAPFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CAPFile.swift; sourceTree = ""; }; 62959AE82524DA7700A3D7F1 /* CAPPluginMethod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CAPPluginMethod.m; sourceTree = ""; }; 62959AE92524DA7700A3D7F1 /* UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; 62959AEF2524DA7700A3D7F1 /* Console.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Console.swift; sourceTree = ""; }; @@ -196,7 +193,6 @@ 62959B112524DA7700A3D7F1 /* Data+Capacitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Data+Capacitor.swift"; sourceTree = ""; }; 62959B122524DA7700A3D7F1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 62959B132524DA7700A3D7F1 /* CAPPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPPlugin.h; sourceTree = ""; }; - 62959B142524DA7700A3D7F1 /* CAPBridge.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CAPBridge.swift; sourceTree = ""; }; 62959B152524DA7700A3D7F1 /* CAPNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CAPNotifications.swift; sourceTree = ""; }; 62959B8225253A9500A3D7F1 /* Capacitor.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Capacitor.modulemap; sourceTree = ""; }; 62959BBD2526510200A3D7F1 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -361,7 +357,6 @@ 62959AE32524DA7700A3D7F1 /* JSExport.swift */, 621ECCD4254205BD00D3D615 /* CAPBridgeProtocol.swift */, 621ECCD9254205C400D3D615 /* CapacitorBridge.swift */, - 62959B142524DA7700A3D7F1 /* CAPBridge.swift */, 62959B042524DA7700A3D7F1 /* CAPBridgeViewController.swift */, 621ECCE2254206A600D3D615 /* CAPApplicationDelegateProxy.swift */, 62959B0A2524DA7700A3D7F1 /* CAPBridgeDelegate.swift */, @@ -375,7 +370,6 @@ 623D691C254C7462002D01D1 /* CAPInstanceConfiguration.m */, 6214934625509C3F006C36F9 /* CAPInstanceConfiguration.swift */, 62959B082524DA7700A3D7F1 /* CAPLog.swift */, - 62959AE72524DA7700A3D7F1 /* CAPFile.swift */, 62959B102524DA7700A3D7F1 /* DocLinks.swift */, 62959B152524DA7700A3D7F1 /* CAPNotifications.swift */, 62959B072524DA7700A3D7F1 /* CapacitorExtension.swift */, @@ -675,8 +669,6 @@ A7D8B3522B238A840003FAD6 /* JSValueEncoder.swift in Sources */, A7F7EDD5292BE8520015B73B /* CAPInstancePlugin.swift in Sources */, A38C3D7B2848BE6F004B3680 /* CapacitorCookieManager.swift in Sources */, - 62959B1B2524DA7800A3D7F1 /* CAPFile.swift in Sources */, - 62959B462524DA7800A3D7F1 /* CAPBridge.swift in Sources */, 62959B1D2524DA7800A3D7F1 /* UIColor.swift in Sources */, 62959B332524DA7800A3D7F1 /* CAPPlugin.m in Sources */, 62959B1C2524DA7800A3D7F1 /* CAPPluginMethod.m in Sources */, diff --git a/ios/Capacitor/Capacitor/CAPBridge.swift b/ios/Capacitor/Capacitor/CAPBridge.swift deleted file mode 100644 index a7b270fab6..0000000000 --- a/ios/Capacitor/Capacitor/CAPBridge.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation - -// the @available compiler directive does not provide an easy way to split apart string literals, so ignore the line length -// swiftlint:disable line_length -@available(*, deprecated, message: "'statusBarTappedNotification' has been moved to Notification.Name.capacitorStatusBarTapped. 'getLastUrl' and application delegate methods have been moved to ApplicationDelegateProxy.") -// swiftlint:enable line_length -@objc public class CAPBridge: NSObject { - @objc public static let statusBarTappedNotification = Notification(name: .capacitorStatusBarTapped) - - public static func getLastUrl() -> URL? { - return ApplicationDelegateProxy.shared.lastURL - } - - public static func handleOpenUrl(_ url: URL, _ options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool { - return ApplicationDelegateProxy.shared.application(UIApplication.shared, open: url, options: options) - } - - public static func handleContinueActivity(_ userActivity: NSUserActivity, _ restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { - return ApplicationDelegateProxy.shared.application(UIApplication.shared, continue: userActivity, restorationHandler: restorationHandler) - } - - public static func handleAppBecameActive(_ application: UIApplication) { - // no-op for now - } -} diff --git a/ios/Capacitor/Capacitor/CAPFile.swift b/ios/Capacitor/Capacitor/CAPFile.swift deleted file mode 100644 index f3ab8a32f2..0000000000 --- a/ios/Capacitor/Capacitor/CAPFile.swift +++ /dev/null @@ -1,14 +0,0 @@ -/** - * CAPFileManager helps map file schemes to physical files, whether they are on - * disk, in a bundle, or in another location. - */ -@objc public class CAPFileManager: NSObject { - @available(*, deprecated, message: "Use portablePath(fromLocalURL:) on the Bridge") - public static func getPortablePath(host: String, uri: URL?) -> String? { - if let uri = uri { - let uriWithoutFile = uri.absoluteString.replacingOccurrences(of: "file://", with: "") - return host + CapacitorBridge.fileStartIdentifier + uriWithoutFile - } - return nil - } -}