GitHub user dpogue added a comment to the discussion: Cordova iOS 8.x Upgrade 
Guide: UIView scrollView property deprecation

This is Cordova-specific.

Both `WKWebView` and the old `UIWebView` have a `scrollView` property that 
returns the underlying `UIScrollView` implementation. Sometimes plugins want to 
interact with this to do things like jumping back to the top of a page.

In old (pre-`WKWebView`) versions of Cordova, CDVPlugin directly exposed the 
`UIWebView` and you could call `scrollView` on it directly. When we moved to 
the pluggable webviews architecture, we could no longer expose a specific type 
of web view, so that property was changed to a generic `UIView` type.

`UIView` does not have a `scrollView` property, but to avoid breaking existing 
plugin code, we added a global category extension to UIView that added a public 
`scrollView` property. That extension would forward the call to the underlying 
web view and return the expected object.

More recently, that started causing problems in projects that use Swift UI, 
because the compiler sees that Cordova is defining a public `scrollView` 
property on `UIView`, and if another subclass of `UIView` has its own 
`scrollView` property that is protected or private, the compiler will throw an 
error about changing the visibility of the property.

For this reason, we've opted to hide/remove the `scrollView` extension entirely 
from Swift, and mark it as deprecated in Objective C because global category 
extensions are generally a bad idea. (IMO, plugins doing things directly to the 
web view's scrollable area are also generally a bad idea, so removing the 
shortcut that makes that easy is not a bad thing)

GitHub link: 
https://github.com/apache/cordova/discussions/565#discussioncomment-14621123

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to