Skip to content

Commit

Permalink
[uikit] Duplicate bindings for 'UIScrollView.ContentOffset' to get co…
Browse files Browse the repository at this point in the history
…rrect availability information. Fixes #4893 (#5007)

`ContentOffset` was moved to `UIFocusItemScrollableContainer` in iOS 12.
Since it's a new protocol it's decorated as introduced in iOS 12 - but
the API was actually already available for a long time.

The _trick_ is to keep the original binding inside `UIScrollView`
so it overrides the protocol and keeps the correct availability info.
It requires adding `new` to bindings to avoid compiler warnings.

reference: #4893

---

from @rolfbjarne 

In iOS 12 this property was moved to a protocol, but that protocol's
availability attributes limits it to iOS 12, not iOS 2 where this property was
originally introduced.

This is problematic, because it means we'll throw a
PlatformNotSupportedException if someone tries to call it on 32-bit iOS.

So put the property back on UIScrollView, so that the generated code ends up
with the right availability attributes (and a correct 32-bit implementation).

#5004
  • Loading branch information
monojenkins authored and spouliot committed Oct 18, 2018
1 parent 99641c7 commit 1ec90f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9718,6 +9718,10 @@ interface UIScrollView : UIFocusItemScrollableContainer {
[Export ("initWithFrame:")]
IntPtr Constructor (CGRect frame);

// moved to UIFocusItemScrollableContainer in iOS 12 - but that makes the availability information incorrect (so `new` is used to avoid compiler warnings)
[Export ("contentOffset")]
new CGPoint ContentOffset { get; set; }

[Export ("contentSize")]
new CGSize ContentSize { get; set; }

Expand Down

1 comment on commit 1ec90f0

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Running XM tests on '10.13', Test docs' 🔥 : hudson.AbortException: script returned exit code 1

Build succeeded
API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
🔥 script returned exit code 1 🔥
Test run succeeded

Please sign in to comment.