-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[UIKit] Update bindings to Xcode 12 Beta 2 #8992
Conversation
src/UIKit/UICellAccessory.cs
Outdated
[MonoPInvokeCallback (typeof (DUICellAccessoryPosition))] | ||
static unsafe nuint Invoke (IntPtr block, IntPtr accessories) { | ||
var descriptor = (BlockLiteral *) block; | ||
var del = (UICellAccessoryPosition) (descriptor->Target); | ||
nuint retval = del (NSArray.ArrayFromHandle<UICellAccessory> (accessories)); | ||
return retval; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can use BlockLiteralRef and avoid it from being unsafe, something like:
static unsafe nuint Invoke (ref BlockLiteral block, IntPtr accessories)
public unsafe NIDUICellAccessoryPosition (BlockLiteral *block) : base (block) | ||
{ | ||
invoker = block->GetDelegateForBlock<DUICellAccessoryPosition> (); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, can we use ref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a copy/paste of generated code and, to remain optimizable, it should follow the exact same pattern
var del = (UICellAccessoryPosition) GetExistingManagedDelegate (block); | ||
return del ?? new NIDUICellAccessoryPosition ((BlockLiteral *) block).Invoke; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move unsafe inside with an unsafe block:
var del = (UICellAccessoryPosition) GetExistingManagedDelegate (block); | |
return del ?? new NIDUICellAccessoryPosition ((BlockLiteral *) block).Invoke; | |
var del = (UICellAccessoryPosition) GetExistingManagedDelegate (block); | |
unsafe { | |
return del ?? new NIDUICellAccessoryPosition ((BlockLiteral *) block).Invoke; | |
} |
src/UIKit/UICellAccessory.cs
Outdated
} | ||
|
||
[BindingImpl (BindingImplOptions.Optimizable)] | ||
unsafe nuint Invoke (UICellAccessory [] accessories) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In unsafe needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope sorry, missed that one cleaning the code produced by the generator
static internal readonly DUIConfigurationColorTransformerHandler Handler = Invoke; | ||
|
||
[MonoPInvokeCallback (typeof (DUIConfigurationColorTransformerHandler))] | ||
static unsafe IntPtr Invoke (IntPtr block, IntPtr color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref BlockLiteral? We get unsafe out.
} | ||
|
||
[BindingImpl (BindingImplOptions.Optimizable)] | ||
unsafe UIColor Invoke (UIColor color) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the unsafe?
NSLayoutConstraint ConstraintEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | ||
|
||
[Mac (10,16)] | ||
[Export ("constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | ||
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | ||
|
||
[Mac (10,16)] | ||
[Export ("constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | ||
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the naming.. but is so verbose! do we need, I'd do:
NSLayoutConstraint ConstraintEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
NSLayoutConstraint EqualToSystemSpaceAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint GreaterThanOrEqualToSystemSpaceAfterAncho (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint LessThanOrEqualToSystemSpaceAfterAncho (NSLayoutXAxisAnchor anchor, nfloat multiplier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately we can't do that, maybe for XAMCORE_4_0. This code exist on iOS too using the same names so we can increase code sharing between the platforms.
see:
Lines 377 to 387 in 4ed6833
[TV (11,0), iOS (11,0)] | |
[Export ("constraintEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[TV (11,0), iOS (11,0)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); | |
[TV (11,0), iOS (11,0)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingAfterAnchor (NSLayoutXAxisAnchor anchor, nfloat multiplier); |
|
||
[Mac (10,16)] | ||
[Export ("constraintEqualToSystemSpacingBelowAnchor:multiplier:")] | ||
NSLayoutConstraint ConstraintEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | ||
|
||
[Mac (10,16)] | ||
[Export ("constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | ||
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | ||
|
||
[Mac (10,16)] | ||
[Export ("constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | ||
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, super verbose:
[Mac (10,16)] | |
[Export ("constraintEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint EqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint GreaterThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[Mac (10,16)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint LessThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same we can't :(
Lines 401 to 411 in 4ed6833
[TV (11,0), iOS (11,0)] | |
[Export ("constraintEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[TV (11,0), iOS (11,0)] | |
[Export ("constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintGreaterThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); | |
[TV (11,0), iOS (11,0)] | |
[Export ("constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:")] | |
NSLayoutConstraint ConstraintLessThanOrEqualToSystemSpacingBelowAnchor (NSLayoutYAxisAnchor anchor, nfloat multiplier); |
|
||
[iOS (14,0)] | ||
[Export ("updateVisibleMenuWithBlock:")] | ||
void UpdateVisibleMenu (Func<UIMenu, UIMenu> handler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use a delegate with names of what UIMenu first and UIMenu second are?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but we gain not much from that, what you get in the parameter is the visible menu and the method is already called UpdateVisibleMenu
and the return is well a menu too :/
[Export ("updateSearchResultsForSearchController:")] | ||
void UpdateSearchResultsForSearchController (UISearchController searchController); | ||
[Export ("updateSearchResultsForSearchController:")] | ||
void UpdateSearchResultsForSearchController (UISearchController searchController); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 'ForSearchController'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't change it, it would be a breaking change :) this is not new, looks like I fixed indentation
Build success |
[Watch (7,0), TV (14,0), iOS (14,0)] | ||
[return: DelegateProxy (typeof (SDUICellAccessoryPosition))] | ||
[BindingImpl (BindingImplOptions.Optimizable)] | ||
public static UICellAccessoryPosition GetPositionBeforeAccessory (Type accessoryType) => GetPositionBeforeAccessory (new Class (accessoryType)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests.
internal delegate nuint DUICellAccessoryPosition (IntPtr block, IntPtr accessories); | ||
|
||
// | ||
// This class bridges native block invocations that call into C# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how complicated it would be to implement support for generating the supporting code for blocks by adding support in the generator for a [GenerateBlockCode]
attribute to delegates:
[GenerateBlockCode]
delegate nuint UICellAccessoryPosition (UICellAccessory [] accessories);
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Build success |
…available on that platform
…o use GetHandle helper
Build failure Test results7 tests failed, 86 tests passed.Failed tests
|
build |
Build success |
Build failure ✅ Build succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 thanks for taking this over @spouliot
Build failure Test results1 tests failed, 92 tests passed.Failed tests
|
test failure is a known, random issue -> https://github.com/xamarin/maccore/issues/1083 |
Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
|
build |
Build success |
We are still missing some APIs that can't be bound in this PR, the following task items are not necessarily needed to merge this PR but will need to be completed by Xcode 12 final:
UICollectionViewDiffableDataSourceSectionSnapshotHandlers<ItemType>
commented properties.UICollectionViewDiffableDataSourceReorderingHandlers<SectionType, ItemType>
commented properties.UTType
from UniformTypeIdentifiers framework is not bound yet:UIDocumentPickerViewController
constructors whenUTType
is bound.UIDocumentBrowserViewController.ctor
whenUTType
is bound.UIDocumentBrowserViewController.ContentTypesForRecentDocuments
whenUTType
is bound.NSOrderedCollectionDifference
from Foundation is not bound yet:NSDiffableDataSourceSectionTransaction<SectionIdentifierType, ItemIdentifierType>.Difference
NSDiffableDataSourceTransaction<SectionIdentifierType, ItemIdentifierType>.Difference
Intents
framework to tvOSUIApplicationDelegate.GetHandlerForIntent
to tvOSUICollectionView.ContextMenuInteraction
[NoWatch, NoTV, NoiOS]UISceneActivationRequestOptions.CollectionJoinBehavior
[NoWatch, NoTV, NoiOS]The above items are now part of #8943