Bug 58282 - [BlockSupport] Can't use Action <bool> in delegate
Summary: [BlockSupport] Can't use Action <bool> in delegate
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: master
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-20 20:31 UTC by Vincent Dondain [MSFT]
Modified: 2017-07-31 17:03 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Vincent Dondain [MSFT] 2017-07-20 20:31:53 UTC
In our bindings we can't do:

delegate void UIContextualActionHandler (UIContextualAction action, UIView sourceView, [BlockCallback] Action<bool> completionHandler);

Here's the original signature:
typedef void (^UIContextualActionHandler)(UIContextualAction * _Nonnull, __kindof UIView * _Nonnull, void (^ _Nonnull)(BOOL));

Here's the build error and generated code that errors: https://gist.github.com/VincentDondain/bb5f25a36065a9e6fba0166fc378ffb1
Comment 1 Vincent Dondain [MSFT] 2017-07-20 20:53:36 UTC
Mmh so it looks like we have a case where:

for a signature of
`// -(void)performBatchUpdates:(void (^ _Nullable)(void))updates completion:(void (^ _Nullable)(BOOL))completion;`

we have `void PerformBatchUpdates (NSAction updates, [NullAllowed] UICompletionHandler completed);`

where `UICompletionHandler` is `delegate void UICompletionHandler (bool finished);`

------

so I maybe could do: `delegate void UIContextualActionHandler (UIContextualAction action, UIView sourceView, [BlockCallback] UIContextualActionCompletionHandler completionHandler);`

and `delegate void UIContextualActionCompletionHandler (bool finished);` ?
Comment 2 Alex Soto [MSFT] 2017-07-20 23:13:26 UTC
> so I maybe could do: `delegate void UIContextualActionHandler (UIContextualAction action, UIView sourceView, [BlockCallback] UIContextualActionCompletionHandler completionHandler);`
>
>and `delegate void UIContextualActionCompletionHandler (bool finished);` ?

Yes that should work and get you unblocked, but yeah I think we should also support Action<bool>

Note You need to log in before you can comment on or make changes to this bug.