capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: Cordova iOS UIView Extension causes incompatibilities

Open neufeng opened this issue 7 months ago • 7 comments

Capacitor Version

Capacitor 7.2.0 XCode 16.3 Swift 5

Other API Details


Platforms Affected

  • [x] iOS
  • [ ] Android
  • [ ] Web

Current Behavior

// CDVPlugin @interface UIView (org_apache_cordova_UIView_Extension)

@property (nonatomic, weak) UIScrollView* scrollView;

@end

When I used in Swift, Compile error with "Found this candidate in module 'Cordova'", the name 'scrollView' in extension is so sample, please use another name, which may be using a prefix, just like cdvScrollView.

Expected Behavior

please use another name, which may be using a prefix, just like cdvScrollView

Project Reproduction

none

Additional Information

No response

neufeng avatar Jun 02 '25 10:06 neufeng

Can you add a bit more detail as to why it is you need this and a reproduction? And add a title?

markemer avatar Jun 02 '25 14:06 markemer

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. Please see the Contributing Guide for how to create a Sample App. Thanks! Ionitron 💙

ionitron-bot[bot] avatar Jun 02 '25 14:06 ionitron-bot[bot]

@markemer I want to use this pod https://github.com/pujiaxin33/JXPagingView. open class JXPagingListContainerView: UIView { public private(set) var type: JXPagingListContainerType public private(set) weak var dataSource: JXPagingListContainerViewDataSource? public private(set) var scrollView: UIScrollView! ....... }

If any other swift view has a property 'scrollView' , it will compile fail, "Found this candidate in module 'Cordova'", the name 'scrollView'"

neufeng avatar Jun 03 '25 01:06 neufeng

CDVPlugin is from Cordova, we include it for Cordova Compatibility, so we can't change this. Feel free to change it for yourself locally, or talk to the Cordova team.

markemer avatar Jun 03 '25 18:06 markemer

We don't use cordova-ios, but our own modified version. Cordova has handled this already here for cordova-ios 8. This is something we might want to address in @capacitor/ios 8, following the same approach, or removing it entirely as it's planned for cordova-ios 9, but having in mind that will break some plugins. Or maybe make the UIView a WKWebView as it already has an UIScrollView, but that could probably lead to other issues.

jcesarmobile avatar Jun 04 '25 13:06 jcesarmobile

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar Jun 04 '25 13:06 ionitron-bot[bot]

We don't use cordova-ios, but our own modified version. Cordova has handled this already here for cordova-ios 8. This is something we might want to address in @capacitor/ios 8, following the same approach, or removing it entirely as it's planned for cordova-ios 9, but having in mind that will break some plugins. Or maybe make the UIView a WKWebView as it already has an UIScrollView, but that could probably lead to other issues.

Yeah, I like that WKWebView idea a lot, but I'd be worried about drifting that far from Cordova in a compatibility layer, but seeing as they plan to remove it entirely in cordova-ios 9, maybe we should jump the gun and just do it. Or follow the same path if we're worried about breakage.

markemer avatar Jun 04 '25 13:06 markemer