Merge pull request #852 from spouliot/intro-model

[test][intro] Check for API parameters that are [Model] and not the [Protocol] interface
This commit is contained in:
Sebastien Pouliot 2017-01-12 17:11:40 -05:00 коммит произвёл GitHub
Родитель 54bfe2c98a 2070d75205
Коммит d2cbd993ad
16 изменённых файлов: 267 добавлений и 37 удалений

Просмотреть файл

@ -26,10 +26,18 @@ namespace XamCore.AVFoundation {
throw new NotSupportedException ("NS_UNAVAILABLE"); throw new NotSupportedException ("NS_UNAVAILABLE");
} }
#if !XAMCORE_4_0
[Obsolete ("Use the overload with a `INSUrlSessionDelegate` parameter.")]
public new static NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue) public new static NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue)
{ {
throw new NotSupportedException ("NS_UNAVAILABLE"); throw new NotSupportedException ("NS_UNAVAILABLE");
} }
#endif
public new static NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, INSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue)
{
throw new NotSupportedException ("NS_UNAVAILABLE");
}
public new static NSUrlSession FromWeakConfiguration (NSUrlSessionConfiguration configuration, NSObject weakDelegate, NSOperationQueue delegateQueue) public new static NSUrlSession FromWeakConfiguration (NSUrlSessionConfiguration configuration, NSObject weakDelegate, NSOperationQueue delegateQueue)
{ {

Просмотреть файл

@ -280,6 +280,7 @@ namespace XamCore.AVFoundation {
throw new NotImplementedException (); throw new NotImplementedException ();
} }
[Obsolete ("Use the overload with a `INSUrlSessionDelegate` parameter.")]
public new static NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue) public new static NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue)
{ {
throw new NotImplementedException (); throw new NotImplementedException ();

Просмотреть файл

@ -13,6 +13,15 @@ namespace XamCore.NetworkExtension {
{ {
} }
} }
public partial class NEPacketTunnelProvider {
[Obsolete ("Use the overload accepting a INWTcpConnectionAuthenticationDelegate argument")]
public virtual NWTcpConnection CreateTcpConnection (NWEndpoint remoteEndpoint, bool enableTls, NWTlsParameters tlsParameters, NWTcpConnectionAuthenticationDelegate @delegate)
{
return CreateTcpConnection (remoteEndpoint, enableTls, tlsParameters, (INWTcpConnectionAuthenticationDelegate) @delegate);
}
}
#endif #endif
} }

Просмотреть файл

@ -8,6 +8,7 @@
using System; using System;
using XamCore.CoreGraphics;
namespace XamCore.UIKit { namespace XamCore.UIKit {
@ -77,5 +78,16 @@ namespace XamCore.UIKit {
{ {
} }
} }
#if !TVOS
public partial class UIPreviewInteraction {
[Obsolete ("Use overload accepting a IUICoordinateSpace")]
public virtual CGPoint GetLocationInCoordinateSpace (UICoordinateSpace coordinateSpace)
{
return GetLocationInCoordinateSpace ((IUICoordinateSpace) coordinateSpace);
}
}
#endif
#endif #endif
} }

Просмотреть файл

@ -18,7 +18,8 @@ using XamCore.Foundation;
namespace XamCore.UIKit { namespace XamCore.UIKit {
public partial class UIActionSheet : IEnumerable { public partial class UIActionSheet : IEnumerable {
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Obsolete ("Use overload with a IUIActionSheetDelegate parameter")]
public UIActionSheet (string title, UIActionSheetDelegate del, string cancelTitle, string destroy, params string [] other) public UIActionSheet (string title, UIActionSheetDelegate del, string cancelTitle, string destroy, params string [] other)
: this (title, del as IUIActionSheetDelegate, cancelTitle, destroy, other) : this (title, del as IUIActionSheetDelegate, cancelTitle, destroy, other)
{ {
@ -46,7 +47,8 @@ namespace XamCore.UIKit {
CancelButtonIndex = AddButton (cancelTitle); CancelButtonIndex = AddButton (cancelTitle);
} }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Obsolete ("Use overload with a IUIActionSheetDelegate parameter")]
public UIActionSheet (string title, UIActionSheetDelegate del) public UIActionSheet (string title, UIActionSheetDelegate del)
: this (title, del as IUIActionSheetDelegate, null, null, (string) null) : this (title, del as IUIActionSheetDelegate, null, null, (string) null)
{ {

Просмотреть файл

@ -16,7 +16,7 @@ using XamCore.Foundation;
namespace XamCore.UIKit { namespace XamCore.UIKit {
public partial class UIAlertView { public partial class UIAlertView {
public UIAlertView (string title, string message, UIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons) public UIAlertView (string title, string message, IUIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons)
: this (title, message, del, cancelButtonTitle, otherButtons == null || otherButtons.Length == 0 ? IntPtr.Zero : new NSString (otherButtons [0]).Handle, IntPtr.Zero, IntPtr.Zero) : this (title, message, del, cancelButtonTitle, otherButtons == null || otherButtons.Length == 0 ? IntPtr.Zero : new NSString (otherButtons [0]).Handle, IntPtr.Zero, IntPtr.Zero)
{ {
if (otherButtons == null) if (otherButtons == null)
@ -26,6 +26,12 @@ namespace XamCore.UIKit {
for (int i = 1; i < otherButtons.Length; i++) for (int i = 1; i < otherButtons.Length; i++)
AddButton (otherButtons [i]); AddButton (otherButtons [i]);
} }
[Obsolete ("Use overload with a IUIAlertViewDelegate parameter")]
public UIAlertView (string title, string message, UIAlertViewDelegate del, string cancelButtonTitle, params string [] otherButtons)
: this (title, message, (IUIAlertViewDelegate) del, cancelButtonTitle, otherButtons)
{
}
} }
} }

Просмотреть файл

@ -67,7 +67,11 @@ namespace XamCore.WebKit {
} }
} }
#if XAMCORE_4_0
public IDomEventListener AddEventListener (string type, DomEventListenerHandler handler, bool useCapture)
#else
public DomEventListener AddEventListener (string type, DomEventListenerHandler handler, bool useCapture) public DomEventListener AddEventListener (string type, DomEventListenerHandler handler, bool useCapture)
#endif
{ {
if (handler == null) if (handler == null)
throw new ArgumentNullException ("handler"); throw new ArgumentNullException ("handler");
@ -76,7 +80,11 @@ namespace XamCore.WebKit {
return obj; return obj;
} }
#if XAMCORE_4_0
public IDomEventListener AddEventListener (string type, Action<DomEvent> callback, bool useCapture)
#else
public DomEventListener AddEventListener (string type, Action<DomEvent> callback, bool useCapture) public DomEventListener AddEventListener (string type, Action<DomEvent> callback, bool useCapture)
#endif
{ {
if (callback == null) if (callback == null)
throw new ArgumentNullException ("callback"); throw new ArgumentNullException ("callback");

Просмотреть файл

@ -140,7 +140,7 @@ namespace XamCore.AppKit {
[Sealed] // Just to avoid the duplicate selector error [Sealed] // Just to avoid the duplicate selector error
IntPtr Constructor (double duration, NSAnimationCurve animationCurve); IntPtr Constructor (double duration, NSAnimationCurve animationCurve);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Obsolete ("Use the constructor instead")] [Obsolete ("Use the constructor instead")]
[Export ("initWithDuration:animationCurve:")] [Export ("initWithDuration:animationCurve:")]
IntPtr Constant (double duration, NSAnimationCurve animationCurve); IntPtr Constant (double duration, NSAnimationCurve animationCurve);
@ -7611,7 +7611,7 @@ namespace XamCore.AppKit {
[Export ("menuDidClose:")] [Export ("menuDidClose:")]
void MenuDidClose (NSMenu menu); void MenuDidClose (NSMenu menu);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("menu:willHighlightItem:")] [Export ("menu:willHighlightItem:")]
@ -8216,7 +8216,7 @@ namespace XamCore.AppKit {
nint RunModal (string [] types); nint RunModal (string [] types);
} }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
// This class doesn't show up in any documentation // This class doesn't show up in any documentation
[BaseType (typeof (NSOpenPanel))] [BaseType (typeof (NSOpenPanel))]
[DisableDefaultCtor] // should not be created by (only returned to) user code [DisableDefaultCtor] // should not be created by (only returned to) user code
@ -11154,7 +11154,7 @@ namespace XamCore.AppKit {
interface INSPasteboardWriting {} interface INSPasteboardWriting {}
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
#if !XAMCORE_3_0 #if !XAMCORE_4_0
// A class that implements only NSPasteboardReading does not make sense, it's // A class that implements only NSPasteboardReading does not make sense, it's
// used to add pasteboard support to existing classes. // used to add pasteboard support to existing classes.
[Model] [Model]
@ -11169,7 +11169,7 @@ namespace XamCore.AppKit {
[Export ("readingOptionsForType:pasteboard:")] [Export ("readingOptionsForType:pasteboard:")]
NSPasteboardReadingOptions GetReadingOptionsForType (string type, NSPasteboard pasteboard); NSPasteboardReadingOptions GetReadingOptionsForType (string type, NSPasteboard pasteboard);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
// This binding is just broken, it's an ObjC ctor (init*) bound as a normal method. // This binding is just broken, it's an ObjC ctor (init*) bound as a normal method.
[Abstract] [Abstract]
[Export ("xamarinselector:removed:")] [Export ("xamarinselector:removed:")]
@ -12520,7 +12520,7 @@ namespace XamCore.AppKit {
} }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
// This class doesn't show up in any documentation. // This class doesn't show up in any documentation.
[BaseType (typeof (NSSavePanel))] [BaseType (typeof (NSSavePanel))]
[DisableDefaultCtor] // should not be created by (only returned to) user code [DisableDefaultCtor] // should not be created by (only returned to) user code
@ -14505,102 +14505,102 @@ namespace XamCore.AppKit {
[Lion] [Lion]
[Protocol] [Protocol]
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Model] [Model]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
#endif #endif
partial interface NSTextFinderClient { partial interface NSTextFinderClient {
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("allowsMultipleSelection")] [Export ("allowsMultipleSelection")]
bool AllowsMultipleSelection { get; } bool AllowsMultipleSelection { get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("editable")] [Export ("editable")]
bool Editable { [Bind ("isEditable")] get; } bool Editable { [Bind ("isEditable")] get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("string", ArgumentSemantic.Copy)] [Export ("string", ArgumentSemantic.Copy)]
string String { get; } string String { get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("firstSelectedRange")] [Export ("firstSelectedRange")]
NSRange FirstSelectedRange { get; } NSRange FirstSelectedRange { get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("selectedRanges", ArgumentSemantic.Copy)] [Export ("selectedRanges", ArgumentSemantic.Copy)]
NSArray SelectedRanges { get; set; } NSArray SelectedRanges { get; set; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("visibleCharacterRanges", ArgumentSemantic.Copy)] [Export ("visibleCharacterRanges", ArgumentSemantic.Copy)]
NSArray VisibleCharacterRanges { get; } NSArray VisibleCharacterRanges { get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("selectable")] [Export ("selectable")]
bool Selectable { [Bind ("isSelectable")] get; } bool Selectable { [Bind ("isSelectable")] get; }
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("stringAtIndex:effectiveRange:endsWithSearchBoundary:")] [Export ("stringAtIndex:effectiveRange:endsWithSearchBoundary:")]
string StringAtIndexeffectiveRangeendsWithSearchBoundary (nuint characterIndex, ref NSRange outRange, bool outFlag); string StringAtIndexeffectiveRangeendsWithSearchBoundary (nuint characterIndex, ref NSRange outRange, bool outFlag);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("stringLength")] [Export ("stringLength")]
nuint StringLength (); nuint StringLength ();
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("scrollRangeToVisible:")] [Export ("scrollRangeToVisible:")]
void ScrollRangeToVisible (NSRange range); void ScrollRangeToVisible (NSRange range);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("shouldReplaceCharactersInRanges:withStrings:")] [Export ("shouldReplaceCharactersInRanges:withStrings:")]
bool ShouldReplaceCharactersInRangeswithStrings (NSArray ranges, NSArray strings); bool ShouldReplaceCharactersInRangeswithStrings (NSArray ranges, NSArray strings);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("replaceCharactersInRange:withString:")] [Export ("replaceCharactersInRange:withString:")]
void ReplaceCharactersInRangewithString (NSRange range, string str); void ReplaceCharactersInRangewithString (NSRange range, string str);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("didReplaceCharacters")] [Export ("didReplaceCharacters")]
void DidReplaceCharacters (); void DidReplaceCharacters ();
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("contentViewAtIndex:effectiveCharacterRange:")] [Export ("contentViewAtIndex:effectiveCharacterRange:")]
NSView ContentViewAtIndexeffectiveCharacterRange (nuint index, ref NSRange outRange); NSView ContentViewAtIndexeffectiveCharacterRange (nuint index, ref NSRange outRange);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("rectsForCharacterRange:")] [Export ("rectsForCharacterRange:")]
NSArray RectsForCharacterRange (NSRange range); NSArray RectsForCharacterRange (NSRange range);
#if !XAMCORE_3_0 #if !XAMCORE_4_0
[Abstract] [Abstract]
#endif #endif
[Export ("drawCharactersInRange:forContentView:")] [Export ("drawCharactersInRange:forContentView:")]
@ -16549,10 +16549,11 @@ namespace XamCore.AppKit {
// This is the mixed NSTableViewDataSource and NSTableViewDelegate // This is the mixed NSTableViewDataSource and NSTableViewDelegate
// //
[Model] [Model]
[Synthetic]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
interface NSTableViewSource { interface NSTableViewSource {
// //
// These come form NSTableViewDataSource // These come from NSTableViewDataSource
// //
[Export ("tableView:willDisplayCell:forTableColumn:row:")] [Export ("tableView:willDisplayCell:forTableColumn:row:")]
void WillDisplayCell (NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row); void WillDisplayCell (NSTableView tableView, NSObject cell, NSTableColumn tableColumn, nint row);

Просмотреть файл

@ -7943,13 +7943,16 @@ namespace XamCore.AVFoundation {
[Export ("alwaysDiscardsLateVideoFrames")] [Export ("alwaysDiscardsLateVideoFrames")]
bool AlwaysDiscardsLateVideoFrames { get; set; } bool AlwaysDiscardsLateVideoFrames { get; set; }
#if !XAMARIN_4_0
[Obsolete ("Use overload accepting a IAVCaptureVideoDataOutputSampleBufferDelegate")]
[Export ("setSampleBufferDelegate:queue:")] [Export ("setSampleBufferDelegate:queue:")]
[PostGet ("SampleBufferDelegate")] [PostGet ("SampleBufferDelegate")]
[PostGet ("SampleBufferCallbackQueue")] [PostGet ("SampleBufferCallbackQueue")]
void SetSampleBufferDelegate ([NullAllowed] AVCaptureVideoDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackQueue); void SetSampleBufferDelegate ([NullAllowed] AVCaptureVideoDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackQueue);
[Export ("setSampleBufferDelegate:queue:")]
[Sealed] [Sealed]
#endif
[Export ("setSampleBufferDelegate:queue:")]
void SetSampleBufferDelegateQueue ([NullAllowed] IAVCaptureVideoDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackQueue); void SetSampleBufferDelegateQueue ([NullAllowed] IAVCaptureVideoDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackQueue);
// 5.0 APIs // 5.0 APIs
@ -7998,16 +8001,22 @@ namespace XamCore.AVFoundation {
[Export ("sampleBufferCallbackQueue")] [Export ("sampleBufferCallbackQueue")]
DispatchQueue SampleBufferCallbackQueue { get; } DispatchQueue SampleBufferCallbackQueue { get; }
#if XAMCORE_4_0
[Export ("setSampleBufferDelegate:queue:")]
void SetSampleBufferDelegate ([NullAllowed] IAVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue);
#else
[Export ("setSampleBufferDelegate:queue:")] [Export ("setSampleBufferDelegate:queue:")]
[Sealed] [Sealed]
void SetSampleBufferDelegateQueue ([NullAllowed] IAVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue); void SetSampleBufferDelegateQueue ([NullAllowed] IAVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue);
[Obsolete ("Use overload accepting a IAVCaptureVideoDataOutputSampleBufferDelegate")]
[Export ("setSampleBufferDelegate:queue:")] [Export ("setSampleBufferDelegate:queue:")]
#if XAMCORE_2_0 #if XAMCORE_2_0
void SetSampleBufferDelegateQueue ([NullAllowed] AVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue); void SetSampleBufferDelegateQueue ([NullAllowed] AVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue);
#else #else
void SetSampleBufferDelegatequeue ([NullAllowed] AVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue); void SetSampleBufferDelegatequeue ([NullAllowed] AVCaptureAudioDataOutputSampleBufferDelegate sampleBufferDelegate, [NullAllowed] DispatchQueue sampleBufferCallbackDispatchQueue);
#endif #endif
#endif
#if !MONOMAC #if !MONOMAC
[Since (7,0)] [Since (7,0)]

Просмотреть файл

@ -5768,6 +5768,8 @@ namespace XamCore.Foundation
delegate void NSUrlDownloadSessionResponse (NSUrl location, NSUrlResponse response, NSError error); delegate void NSUrlDownloadSessionResponse (NSUrl location, NSUrlResponse response, NSError error);
interface INSUrlSessionDelegate {}
// //
// Some of the XxxTaskWith methods that take a completion were flagged as allowing a null in // Some of the XxxTaskWith methods that take a completion were flagged as allowing a null in
// 083d9cba1eb997eac5c5ded77db32180c3eef566 with comment: // 083d9cba1eb997eac5c5ded77db32180c3eef566 with comment:
@ -5797,8 +5799,13 @@ namespace XamCore.Foundation
[Static, Export ("sessionWithConfiguration:delegate:delegateQueue:")] [Static, Export ("sessionWithConfiguration:delegate:delegateQueue:")]
NSUrlSession FromWeakConfiguration (NSUrlSessionConfiguration configuration, [NullAllowed] NSObject weakDelegate, [NullAllowed] NSOperationQueue delegateQueue); NSUrlSession FromWeakConfiguration (NSUrlSessionConfiguration configuration, [NullAllowed] NSObject weakDelegate, [NullAllowed] NSOperationQueue delegateQueue);
#if !XAMCORE_4_0
[Obsolete ("Use the overload with a `INSUrlSessionDelegate` parameter.")]
[Static, Wrap ("FromWeakConfiguration (configuration, sessionDelegate, delegateQueue);")] [Static, Wrap ("FromWeakConfiguration (configuration, sessionDelegate, delegateQueue);")]
NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue); NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, NSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue);
#endif
[Static, Wrap ("FromWeakConfiguration (configuration, (NSObject) sessionDelegate, delegateQueue);")]
NSUrlSession FromConfiguration (NSUrlSessionConfiguration configuration, INSUrlSessionDelegate sessionDelegate, NSOperationQueue delegateQueue);
[Export ("delegateQueue", ArgumentSemantic.Retain)] [Export ("delegateQueue", ArgumentSemantic.Retain)]
NSOperationQueue DelegateQueue { get; } NSOperationQueue DelegateQueue { get; }
@ -10536,6 +10543,8 @@ namespace XamCore.Foundation
#endif #endif
delegate void NSFileCoordinatorWorkerRW (NSUrl newReadingUrl, NSUrl newWritingUrl); delegate void NSFileCoordinatorWorkerRW (NSUrl newReadingUrl, NSUrl newWritingUrl);
interface INSFilePresenter {}
[Since (5,0)] [Since (5,0)]
[BaseType (typeof (NSObject))] [BaseType (typeof (NSObject))]
interface NSFileCoordinator { interface NSFileCoordinator {
@ -10553,7 +10562,13 @@ namespace XamCore.Foundation
[DesignatedInitializer] [DesignatedInitializer]
[Export ("initWithFilePresenter:")] [Export ("initWithFilePresenter:")]
IntPtr Constructor ([NullAllowed] INSFilePresenter filePresenterOrNil);
#if !XAMCORE_4_0
[Obsolete ("Use .ctor(INSFilePresenter) instead")]
[Wrap ("this ((INSFilePresenter) filePresenterOrNil)")]
IntPtr Constructor ([NullAllowed] NSFilePresenter filePresenterOrNil); IntPtr Constructor ([NullAllowed] NSFilePresenter filePresenterOrNil);
#endif
[Export ("coordinateReadingItemAtURL:options:error:byAccessor:")] [Export ("coordinateReadingItemAtURL:options:error:byAccessor:")]
#if XAMCORE_2_0 #if XAMCORE_2_0

Просмотреть файл

@ -1170,6 +1170,8 @@ namespace XamCore.NetworkExtension {
void WriteClose (); void WriteClose ();
} }
interface INWTcpConnectionAuthenticationDelegate {}
[iOS (9,0)][Mac (10,11, onlyOn64 : true)] [iOS (9,0)][Mac (10,11, onlyOn64 : true)]
[Protocol, Model] [Protocol, Model]
[BaseType (typeof (NSObject), Name = "NWTCPConnectionAuthenticationDelegate")] [BaseType (typeof (NSObject), Name = "NWTCPConnectionAuthenticationDelegate")]
@ -1352,7 +1354,7 @@ namespace XamCore.NetworkExtension {
NEPacketTunnelFlow PacketFlow { get; } NEPacketTunnelFlow PacketFlow { get; }
[Export ("createTCPConnectionThroughTunnelToEndpoint:enableTLS:TLSParameters:delegate:")] [Export ("createTCPConnectionThroughTunnelToEndpoint:enableTLS:TLSParameters:delegate:")]
NWTcpConnection CreateTcpConnection (NWEndpoint remoteEndpoint, bool enableTls, [NullAllowed] NWTlsParameters tlsParameters, [NullAllowed] NWTcpConnectionAuthenticationDelegate @delegate); NWTcpConnection CreateTcpConnection (NWEndpoint remoteEndpoint, bool enableTls, [NullAllowed] NWTlsParameters tlsParameters, [NullAllowed] INWTcpConnectionAuthenticationDelegate @delegate);
[Export ("createUDPSessionThroughTunnelToEndpoint:fromEndpoint:")] [Export ("createUDPSessionThroughTunnelToEndpoint:fromEndpoint:")]
NWUdpSession CreateUdpSession (NWEndpoint remoteEndpoint, [NullAllowed] NWHostEndpoint localEndpoint); NWUdpSession CreateUdpSession (NWEndpoint remoteEndpoint, [NullAllowed] NWHostEndpoint localEndpoint);

Просмотреть файл

@ -516,7 +516,13 @@ namespace XamCore.PassKit {
[DesignatedInitializer] [DesignatedInitializer]
[Export ("initWithRequestConfiguration:delegate:")] [Export ("initWithRequestConfiguration:delegate:")]
IntPtr Constructor (PKAddPaymentPassRequestConfiguration configuration, [NullAllowed] PKAddPaymentPassViewControllerDelegate viewControllerDelegate); IntPtr Constructor (PKAddPaymentPassRequestConfiguration configuration, [NullAllowed] IPKAddPaymentPassViewControllerDelegate viewControllerDelegate);
#if !XAMCORE_4_0
[Obsolete ("Use the overload accepting a IPKAddPaymentPassViewControllerDelegate")]
[Wrap ("this (configuration, (IPKAddPaymentPassViewControllerDelegate) viewControllerDelegate)")]
IntPtr Constructor (PKAddPaymentPassRequestConfiguration configuration, PKAddPaymentPassViewControllerDelegate viewControllerDelegate);
#endif
[Wrap ("WeakDelegate")] [Wrap ("WeakDelegate")]
[NullAllowed, Protocolize] [NullAllowed, Protocolize]
@ -526,6 +532,8 @@ namespace XamCore.PassKit {
NSObject WeakDelegate { get; set; } NSObject WeakDelegate { get; set; }
} }
interface IPKAddPaymentPassViewControllerDelegate {}
[Protocol, Model] [Protocol, Model]
[BaseType (typeof(NSObject))] [BaseType (typeof(NSObject))]
interface PKAddPaymentPassViewControllerDelegate interface PKAddPaymentPassViewControllerDelegate

Просмотреть файл

@ -2065,6 +2065,8 @@ namespace XamCore.UIKit {
UIAlertAction PreferredAction { get; set; } UIAlertAction PreferredAction { get; set; }
} }
interface IUIAlertViewDelegate {}
[NoTV] [NoTV]
[BaseType (typeof (UIView), KeepRefUntil="Dismissed", Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UIAlertViewDelegate)})] [BaseType (typeof (UIView), KeepRefUntil="Dismissed", Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof(UIAlertViewDelegate)})]
[Availability (Deprecated = Platform.iOS_9_0, Message = "Use UIAlertController with a UIAlertControllerStyle.Alert type instead")] [Availability (Deprecated = Platform.iOS_9_0, Message = "Use UIAlertController with a UIAlertControllerStyle.Alert type instead")]
@ -2083,7 +2085,7 @@ namespace XamCore.UIKit {
// arguments (id, SEL), which means we only need 7 more. And 'mustAlsoBeNull' is that 7th argument. // arguments (id, SEL), which means we only need 7 more. And 'mustAlsoBeNull' is that 7th argument.
// So on ARM64 the 8th argument ('mustBeNull') is ignored, and iOS sees the 9th argument ('mustAlsoBeNull') as the 8th argument. // So on ARM64 the 8th argument ('mustBeNull') is ignored, and iOS sees the 9th argument ('mustAlsoBeNull') as the 8th argument.
[Availability (Deprecated=Platform.iOS_8_0, Message="Use UIAlertController instead")] [Availability (Deprecated=Platform.iOS_8_0, Message="Use UIAlertController instead")]
IntPtr Constructor ([NullAllowed] string title, [NullAllowed] string message, [NullAllowed] UIAlertViewDelegate viewDelegate, [NullAllowed] string cancelButtonTitle, IntPtr otherButtonTitles, IntPtr mustBeNull, IntPtr mustAlsoBeNull); IntPtr Constructor ([NullAllowed] string title, [NullAllowed] string message, [NullAllowed] IUIAlertViewDelegate viewDelegate, [NullAllowed] string cancelButtonTitle, IntPtr otherButtonTitles, IntPtr mustBeNull, IntPtr mustAlsoBeNull);
[Wrap ("WeakDelegate")] [Wrap ("WeakDelegate")]
[Protocolize] [Protocolize]
@ -8781,7 +8783,12 @@ namespace XamCore.UIKit {
[NullAllowed] // by default this property is null [NullAllowed] // by default this property is null
[Export ("dataSource", ArgumentSemantic.Assign)] [Export ("dataSource", ArgumentSemantic.Assign)]
#if XAMCORE_4_0
IUIPickerViewDataSource DataSource { get; set; }
#else
// should have been WeakDataSource
NSObject DataSource { get; set; } NSObject DataSource { get; set; }
#endif
[Export ("delegate", ArgumentSemantic.Assign)][NullAllowed] [Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
NSObject WeakDelegate { get; set; } NSObject WeakDelegate { get; set; }
@ -15930,7 +15937,7 @@ namespace XamCore.UIKit {
IUIPreviewInteractionDelegate Delegate { get; set; } IUIPreviewInteractionDelegate Delegate { get; set; }
[Export ("locationInCoordinateSpace:")] [Export ("locationInCoordinateSpace:")]
CGPoint GetLocationInCoordinateSpace ([NullAllowed] UICoordinateSpace coordinateSpace); CGPoint GetLocationInCoordinateSpace ([NullAllowed] IUICoordinateSpace coordinateSpace);
[Export ("cancelInteraction")] [Export ("cancelInteraction")]
void CancelInteraction (); void CancelInteraction ();

Просмотреть файл

@ -192,10 +192,10 @@ namespace Introspection {
public Type CurrentType { get; private set; } public Type CurrentType { get; private set; }
const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; const BindingFlags Flags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
[Test] [Test]
public void Signatures () public void NativeSignatures ()
{ {
int n = 0; int n = 0;
Errors = 0; Errors = 0;
@ -794,5 +794,76 @@ namespace Introspection {
} }
return false; return false;
} }
#if XAMCORE_2_0
[Test]
#endif
public void ManagedSignature ()
{
int n = 0;
Errors = 0;
ErrorData.Clear ();
foreach (Type t in Assembly.GetTypes ()) {
if (!NSObjectType.IsAssignableFrom (t))
continue;
CurrentType = t;
foreach (MethodInfo m in t.GetMethods (Flags))
CheckManagedMemberSignatures (m, t, ref n);
foreach (MethodBase m in t.GetConstructors (Flags))
CheckManagedMemberSignatures (m, t, ref n);
}
AssertIfErrors ("{0} errors found in {1} signatures validated{2}", Errors, n, Errors == 0 ? string.Empty : ":\n" + ErrorData.ToString () + "\n");
}
protected virtual bool CheckType (Type t, ref int n)
{
if (t.IsArray)
return CheckType (t.GetElementType (), ref n);
// e.g. NSDictionary<NSString,NSObject> needs 3 check
if (t.IsGenericType) {
foreach (var ga in t.GetGenericArguments ())
return CheckType (ga, ref n);
}
// look for [Model] types
if (t.GetCustomAttribute<ModelAttribute> (false) == null)
return true;
n++;
switch (t.Name) {
case "CAAnimationDelegate": // this was not a protocol before iOS 10 and was not bound as such
return true;
default:
return false;
}
}
protected virtual void CheckManagedMemberSignatures (MethodBase m, Type t, ref int n)
{
// if the method was obsoleted then it's not an issue, we assume the alternative is fine
if (m.GetCustomAttribute<ObsoleteAttribute> () != null)
return;
if (m.DeclaringType != t)
return;
CurrentMethod = m;
foreach (var p in m.GetParameters ()) {
var pt = p.ParameterType;
// skip methods added inside the [Model] type - those are fine
if (t == pt)
continue;
if (!CheckType (pt, ref n))
ReportError ($"`{t.Name}.{m.Name}` includes a parameter of type `{pt.Name}` which is a concrete type `[Model]` and not an interface `[Protocol]`");
}
if (!m.IsConstructor) {
var rt = (m as MethodInfo).ReturnType;
if (!CheckType (rt, ref n))
ReportError ($"`{t.Name}.{m.Name}` return type `{rt.Name}` is a concrete type `[Model]` and not an interface `[Protocol]`");
}
}
} }
} }

Просмотреть файл

@ -239,5 +239,38 @@ namespace Introspection {
} }
return base.Check (encodedType, type); return base.Check (encodedType, type);
} }
protected override bool CheckType (Type t, ref int n)
{
switch (t.Name) {
#if !XAMCORE_4_0
case "NSPasteboardReading":
case "NSPasteboardWriting":
#endif
return true;
}
return base.CheckType (t, ref n);
}
protected override void CheckManagedMemberSignatures (MethodBase m, Type t, ref int n)
{
#if !XAMCORE_4_0 // let's review the tests exceptions if we break things
switch (m.Name) {
case "get_Source":
case "set_Source":
// NSTableViewSource is our own creation and we did not make an interface out of it
if (t.Name == "NSTableView")
return;
break;
case "AddEventListener":
// Fixed in XAMCORE_4_0
if (t.Name == "DomNode")
return;
break;
}
#endif
base.CheckManagedMemberSignatures (m, t, ref n);
}
} }
} }

Просмотреть файл

@ -176,5 +176,43 @@ namespace Introspection {
} }
return base.Check (encodedType, type); return base.Check (encodedType, type);
} }
protected override void CheckManagedMemberSignatures (MethodBase m, Type t, ref int n)
{
#if !XAMCORE_4_0 // let's review the tests exceptions if we break things
switch (m.Name) {
case "get_Source":
case "set_Source":
// UITableViewSource is our own creation and we did not make an interface out of it
if (t.Name == "UITableView")
return;
// UICollectionViewSource is our own creation and we did not make an interface out of it
if (t.Name == "UICollectionView")
return;
break;
case "get_SearchResultsSource":
case "set_SearchResultsSource":
// UITableViewSource is our own creation and we did not make an interface out of it
if (t.Name == "UISearchDisplayController")
return;
break;
case "get_ImagePickerControllerDelegate":
case "set_ImagePickerControllerDelegate":
case "get_NavigationControllerDelegate":
case "set_NavigationControllerDelegate":
// fixed in XAMCORE_4_0 - alternative are the Weak* delegates
if (t.Name == "UIImagePickerController")
return;
break;
case "get_Model":
case "set_Model":
// UIPickerViewModel is our own creation and we did not make an interface out of it
if (t.Name == "UIPickerView")
return;
break;
}
#endif
base.CheckManagedMemberSignatures (m, t, ref n);
}
} }
} }