You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: CAPPlugin listener methods can no longer be overridden in Capacitor 9 (iOS) #8728
Since #8559 (feat!(ios): adopting SwiftUI), notifyListeners(_:data:), notifyListeners(_:data:retainUntilConsumed:), removeListener(_:) and removeAllListeners(_:) moved into the Swift @objc public extension CAPPlugin in CAPPlugin+Bridge.swift. They used to be overridable Obj-C methods on CAPPlugin.
Swift can't override declarations from an extension, so any plugin that overrides them no longer compiles:
overridepublicfuncremoveAllListeners(_call:CAPPluginCall){
// stop native observers, then
super.removeAllListeners(call)}
This is a common pattern. Plugins override removeAllListeners to tear down native observers (Firebase Remote Config, Firestore snapshot listeners), and test targets override notifyListeners to capture emitted events. We hit it on @capgo/capacitor-updater and @capacitor-firebase/* while migrating to Capacitor 9.
Expected Behavior
Either keep these methods overridable (open, or move them back into the class body), or provide a documented hook such as an overridable handleListenersRemoved() so plugins can clean up, and note the change in the Capacitor 9 plugin migration guide.
Activity