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
[ios11-beta1] Initial UIKit Drag and Drop support #2190
Changes from 8 commits
30d911a
94f7013
4849fa7
3c56df8
14d9105
fcb81d9
8a44db7
0643d17
6c87a94
897f203
631e676
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,6 +237,17 @@ partial interface NSAttributedString : NSCoding, NSMutableCopying, NSSecureCodin | |
[Wrap ("this (data, options == null ? null : options.Dictionary, out resultDocumentAttributes, ref error)")] | ||
IntPtr Constructor (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref NSError error); | ||
|
||
// From the NSItemProviderReading protocol, a special constructor. | ||
[Export ("initWithItemProviderData:typeIdentifier:error:")] | ||
[iOS (11,0), NoWatch, NoTV, Mac(10,13)] | ||
IntPtr Constructor (NSData providerData, string typeIdentifier, out NSError outError); | ||
|
||
// From the NSItemProviderReading protocol, a static method. | ||
[Static] | ||
[Export ("readableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)] | ||
[iOS (11,0), NoWatch, NoTV, Mac(10,13)] | ||
string[] ReadableTypeIdentifiersForItemProvider { get; } | ||
|
||
[Since (7,0)] | ||
[Export ("dataFromRange:documentAttributes:error:")] | ||
NSData GetDataFromRange (NSRange range, NSDictionary attributes, ref NSError error); | ||
|
@@ -8780,6 +8791,35 @@ partial interface NSItemProvider : NSCopying { | |
#endif | ||
} | ||
|
||
interface INSItemProviderReading {} | ||
|
||
[Watch (4,0), TV (11,0), Mac (10,13), iOS (11,0)] | ||
[Protocol] | ||
interface NSItemProviderReading | ||
{ | ||
// | ||
// This static method has to be implemented on each class that implements | ||
// this, this is not a capability that exists in C#. | ||
// We are inlining these on each class that implements NSItemProviderReading | ||
// for the sake of the method being callable from C#, for user code, the | ||
// user needs to manually [Export] the selector on a static method, like | ||
// they do for the "layer" property on CALayer subclasses. | ||
// | ||
//[Static, Abstract] | ||
//[Export ("readableTypeIdentifiersForItemProvider", ArgumentSemantic.Copy)] | ||
//string[] ReadableTypeIdentifiersForItemProvider { get; } | ||
|
||
// | ||
// This is a constructor that various classes must implement | ||
// NSAttributedString, UIColor and UIImage need to have this constructor | ||
// for user-defined implementations of this interface, we are going to | ||
// need to something special | ||
// | ||
//[Abstract] | ||
//[Export ("initWithItemProviderData:typeIdentifier:error:")] | ||
//INSItemProviderReading CreateFrom (NSData providerData, string typeIdentifier, [NullAllowed] NSError outError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the method being bound separately in the different classes instead of having the classes implement INSItemProviderReading? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See bug: https://bugzilla.xamarin.com/show_bug.cgi?id=57650 for details. The runtime needs some changes to support the idiom. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I've stated on the bug I believe the runtime doesn't need changes to make it work, so this can be uncommented (and the CreateFrom method should be a proper Constructor, not a method). The registrars can provide some help for users, but it needs these methods properly defined in order to have enough information to help users. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What this patch does is to inline the constructor in all three places that conform to this procotol. I tried doing what you suggested (a) removing the above line, and (b) removing the inlined constructors that this patch contains everywhere and (c) making those classes adopt the NSItemProviderReading interface, but that does not inline the constructor anywhere, nor does the interface gain anything out of having this method declared here. The result is thus a step backwards, the patch to that is here: https://gist.github.com/migueldeicaza/e22f44007e7ac093a0076276187dcb16 So I am not sure what is that you are suggesting I do with this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant only uncommenting the code here, inside In any case I can fix this when I look at the corresponding bug. |
||
} | ||
|
||
#if XAMCORE_2_0 | ||
[Static] | ||
#endif | ||
|
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.
Does this actually work? From what I can tell trying to bind the Static property inside the interface doesn't seem to actually generate the code for it.